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

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

Issue 1691723004: Only allow |0 and *1.0 for asm validator foreign variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 cadd1bba0a4c048f9690a9f8875eed4df77d3db6..97530335ebe08a988eba849ba169fc9bef814ac6 100644
--- a/test/cctest/test-asm-validator.cc
+++ b/test/cctest/test-asm-validator.cc
@@ -2101,6 +2101,62 @@ TEST(BadVariableReference) {
Validate(zone, test_function, &types));
}
+TEST(BadForeignVariableReferenceValueOr) {
+ const char test_function[] =
+ "function TestModule(stdlib, foreign, buffer) {\n"
+ " \"use asm\";\n"
+ " var fint = foreign.bar | 1;\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 3: illegal integer annotation value\n",
+ Validate(zone, test_function, &types));
+}
+
+TEST(BadForeignVariableReferenceValueOrDot) {
+ const char test_function[] =
+ "function TestModule(stdlib, foreign, buffer) {\n"
+ " \"use asm\";\n"
+ " var fint = foreign.bar | 1.0;\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 3: illegal integer annotation value\n",
+ Validate(zone, test_function, &types));
+}
+
+TEST(BadForeignVariableReferenceValueMul) {
+ const char test_function[] =
+ "function TestModule(stdlib, foreign, buffer) {\n"
+ " \"use asm\";\n"
+ " var fint = foreign.bar * 2.0;\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 3: illegal double annotation value\n",
+ Validate(zone, test_function, &types));
+}
+
+TEST(BadForeignVariableReferenceValueMulNoDot) {
+ const char test_function[] =
+ "function TestModule(stdlib, foreign, buffer) {\n"
+ " \"use asm\";\n"
+ " var fint = foreign.bar * 1;\n"
+ "}\n";
+ v8::V8::Initialize();
+ HandleAndZoneScope handles;
+ Zone* zone = handles.main_zone();
+ ZoneVector<ExpressionTypeEntry> types(zone);
+ CHECK_EQ("asm: line 3: ill-typed arithmetic operation\n",
+ Validate(zone, test_function, &types));
+}
+
TEST(Imports) {
const char test_function[] =
"function TestModule(stdlib, foreign, buffer) {\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