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

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

Issue 2435823002: [V8][asm.js] Adds support to global const variables. (Closed)
Patch Set: Addresses comments. Created 4 years, 2 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') | test/mjsunit/asm/asm-validation.js » ('j') | 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 828a0cd12e3a2b7dd3bfcc28b6a7c5aeaf243779..290bd6c814f4a7b25919fbee48d6d62f7dc5f4e5 100644
--- a/test/cctest/asmjs/test-asm-typer.cc
+++ b/test/cctest/asmjs/test-asm-typer.cc
@@ -505,14 +505,15 @@ TEST(ErrorsInGlobalVariableDefinition) {
const char* error_message;
} kTests[] = {
{"var v;", "Global variable missing initializer"},
- {"var v = uninitialized;", "Invalid global variable initializer"},
+ {"var v = uninitialized;", "Undeclared identifier in global"},
{"var v = 'use asm';", "type annotation - forbidden literal"},
{"var v = 4294967296;", " - forbidden literal"},
- {"var v = not_fround;", "Invalid global variable initializer"},
+ {"var v = not_fround;", "initialize a global must be a const"},
{"var v = not_fround(1);", "expected call fround(literal)"},
{"var v = __fround__(1.0);", "expected call fround(literal)"},
{"var v = fround(1.0, 1.0);", "expected call fround(literal)"},
{"var v = fround(not_fround);", "literal argument for call to fround"},
+ {"var v = i?0:1;", "Invalid global variable initializer"},
{"var v = stdlib.nan", "Invalid import"},
{"var v = stdlib.Math.nan", "Invalid import"},
{"var v = stdlib.Mathh.E", "Invalid import"},
@@ -788,6 +789,19 @@ TEST(ErrorsInFunction) {
" var c = 0;\n"
"}\n",
"Local variable missing initializer in asm.js module"},
+ {"function f(a) {\n"
+ " a = a|0;\n"
+ " var x = a;\n"
+ "}\n",
+ "variable declaration initializer must be const"},
+ {"function f() {\n"
+ " var x = 1+i;\n"
+ "}\n",
+ "should be a literal, const, or fround(literal"},
+ {"function f() {\n"
+ " var x = a;\n"
+ "}\n",
+ "Undeclared identifier in variable declaration initializer"},
{"function f() {\n"
" function ff() {}\n"
"}\n",
@@ -812,6 +826,19 @@ TEST(ErrorsInFunction) {
" return 2147483648;\n"
"}\n",
"Invalid literal in return statement"},
+ {"function f(a) {\n"
+ " a = a|0;\n"
+ " return a;\n"
+ "}\n",
+ "in return statement is not const"},
+ {"function f() {\n"
+ " return a;\n"
+ "}\n",
+ "Undeclared identifier in return statement"},
+ {"function f() {\n"
+ " return i?0:1;\n"
+ "}\n",
+ "Invalid return type expression"},
{"function f() {\n"
" return stdlib.Math.E;"
"}\n",
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698