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

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

Issue 1453343003: Fix multiple return statements in typing-asm, cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 8c4fec16f2f6f67135379eef5d6443a9c7fba5a6..72fe9e0f0e82b2a1ae20bad14e4c3ebe0b2dd58d 100644
--- a/test/cctest/test-asm-validator.cc
+++ b/test/cctest/test-asm-validator.cc
@@ -1419,6 +1419,23 @@ TEST(BadLiteral) {
}
+TEST(MismatchedReturnTypeLiteral) {
+ CHECK_FUNC_ERROR(
+ "function bar() { if(1) { return 1; } return 1.0; }\n"
+ "function foo() { bar(); }",
+ "asm: line 39: return type does not match function signature\n");
+}
+
+
+TEST(MismatchedReturnTypeExpression) {
+ CHECK_FUNC_ERROR(
+ "function bar() {\n"
+ " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n"
+ "function foo() { bar(); }",
+ "asm: line 40: return type does not match function signature\n");
+}
+
+
TEST(ForeignFunction) {
CHECK_FUNC_TYPES_BEGIN(
"var baz = foreign.baz;\n"
@@ -1469,15 +1486,47 @@ TEST(BadExports) {
TEST(TypeConsistency) {
v8::V8::Initialize();
- // HandleAndZoneScope handles;
- // Zone* zone = handles.main_zone();
TypeCache cache;
-
-
- CHECK(!cache.kAsmSigned->Is(cache.kAsmDouble));
- CHECK(!cache.kAsmSigned->Is(cache.kAsmFloat));
- CHECK(!cache.kAsmSigned->Is(cache.kAsmUnsigned));
- CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned));
+ // Check the consistency of each of the main Asm.js types.
+ CHECK(cache.kAsmFixnum->Is(cache.kAsmFixnum));
+ CHECK(cache.kAsmFixnum->Is(cache.kAsmSigned));
+ CHECK(cache.kAsmFixnum->Is(cache.kAsmUnsigned));
+ CHECK(cache.kAsmFixnum->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmFixnum->Is(cache.kAsmFloat));
+ CHECK(!cache.kAsmFixnum->Is(cache.kAsmDouble));
+
+ CHECK(cache.kAsmSigned->Is(cache.kAsmSigned));
CHECK(cache.kAsmSigned->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmSigned->Is(cache.kAsmFixnum));
+ CHECK(!cache.kAsmSigned->Is(cache.kAsmUnsigned));
+ CHECK(!cache.kAsmSigned->Is(cache.kAsmFloat));
CHECK(!cache.kAsmSigned->Is(cache.kAsmDouble));
+
+ CHECK(cache.kAsmUnsigned->Is(cache.kAsmUnsigned));
+ CHECK(cache.kAsmUnsigned->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmUnsigned->Is(cache.kAsmSigned));
+ CHECK(!cache.kAsmUnsigned->Is(cache.kAsmFixnum));
+ CHECK(!cache.kAsmUnsigned->Is(cache.kAsmFloat));
+ CHECK(!cache.kAsmUnsigned->Is(cache.kAsmDouble));
+
+ CHECK(cache.kAsmInt->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmInt->Is(cache.kAsmUnsigned));
+ CHECK(!cache.kAsmInt->Is(cache.kAsmSigned));
+ CHECK(!cache.kAsmInt->Is(cache.kAsmFixnum));
+ CHECK(!cache.kAsmInt->Is(cache.kAsmFloat));
+ CHECK(!cache.kAsmInt->Is(cache.kAsmDouble));
+
+ CHECK(cache.kAsmFloat->Is(cache.kAsmFloat));
+ CHECK(!cache.kAsmFloat->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmFloat->Is(cache.kAsmUnsigned));
+ CHECK(!cache.kAsmFloat->Is(cache.kAsmSigned));
+ CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum));
+ CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble));
+
+ CHECK(cache.kAsmDouble->Is(cache.kAsmDouble));
+ CHECK(!cache.kAsmDouble->Is(cache.kAsmInt));
+ CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned));
+ CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned));
+ CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum));
+ CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat));
}
« 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