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

Unified Diff: test/cctest/test-asm-validator.cc

Issue 1569423002: Reject lack of "use asm" marker in asm typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/typing-asm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-asm-validator.cc
diff --git a/test/cctest/test-asm-validator.cc b/test/cctest/test-asm-validator.cc
index 3e6bcd305a2f1f73bb99663978d42bf57daa6e77..7f3b1194ff6e19dbe0f7ea2748165e63dd77e78b 100644
--- a/test/cctest/test-asm-validator.cc
+++ b/test/cctest/test-asm-validator.cc
@@ -309,6 +309,52 @@ TEST(ValidateMinimum) {
}
+TEST(MissingUseAsm) {
+ const char test_function[] =
+ "function foo() {\n"
+ " function bar() {}\n"
+ " return { bar: bar };\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 1: missing \"use asm\"\n",
+ Validate(zone, test_function, &types));
+}
+
+
+TEST(WrongUseAsm) {
+ const char test_function[] =
+ "function foo() {\n"
+ " \"use wasm\"\n"
+ " function bar() {}\n"
+ " return { bar: bar };\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 1: missing \"use asm\"\n",
+ Validate(zone, test_function, &types));
+}
+
+
+TEST(MissingReturnExports) {
aseemgarg 2016/01/08 22:30:56 Is this correct? Although useless, it is not clear
bradn 2016/01/09 01:05:53 Actually it does seem to require a ValidateExports
+ const char test_function[] =
+ "function foo() {\n"
+ " \"use asm\"\n"
+ " function bar() {}\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 2: last statement in module is not a return\n",
+ Validate(zone, test_function, &types));
+}
+
+
#define HARNESS_STDLIB() \
"var Infinity = stdlib.Infinity;\n" \
"var NaN = stdlib.NaN;\n" \
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698