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

Side by Side Diff: test/cctest/test-asm-validator.cc

Issue 1832603002: Properly handle unsigned literals, fix typing issue with unary +. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop print Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/ast-expression-visitor.h" 8 #include "src/ast/ast-expression-visitor.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/parsing/parser.h" 10 #include "src/parsing/parser.h"
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 1978
1979 1979
1980 TEST(BadFunctionCallOutside) { 1980 TEST(BadFunctionCallOutside) {
1981 CHECK_FUNC_ERROR( 1981 CHECK_FUNC_ERROR(
1982 "function bar() { return 0.0; }\n" 1982 "function bar() { return 0.0; }\n"
1983 "var s0 = bar(0);\n" 1983 "var s0 = bar(0);\n"
1984 "function foo() { bar(); }", 1984 "function foo() { bar(); }",
1985 "asm: line 2: illegal variable reference in module body\n"); 1985 "asm: line 2: illegal variable reference in module body\n");
1986 } 1986 }
1987 1987
1988 TEST(UnaryPlusOnIntForbidden) {
1989 CHECK_FUNC_ERROR(
1990 "function bar() { var x = 1; return +x; }\n"
1991 "function foo() { bar(); }",
1992 "asm: line 1: "
1993 "unary + only allowed on signed, unsigned, float?, or double?\n");
1994 }
1995
1996 TEST(MultiplyNon1ConvertForbidden) {
1997 CHECK_FUNC_ERROR(
1998 "function bar() { var x = 0.0; return x * 2.0; }\n"
1999 "function foo() { bar(); }",
2000 "asm: line 1: invalid type annotation on binary op\n");
2001 }
1988 2002
1989 TEST(NestedVariableAssignment) { 2003 TEST(NestedVariableAssignment) {
1990 CHECK_FUNC_TYPES_BEGIN( 2004 CHECK_FUNC_TYPES_BEGIN(
1991 "function bar() { var x = 0; x = x = 4; }\n" 2005 "function bar() { var x = 0; x = x = 4; }\n"
1992 "function foo() { bar(); }") { 2006 "function foo() { bar(); }") {
1993 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 2007 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1994 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 2008 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1995 CHECK_VAR(x, Bounds(cache.kAsmInt)); 2009 CHECK_VAR(x, Bounds(cache.kAsmInt));
1996 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 2010 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1997 } 2011 }
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 2505 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
2492 CHECK_VAR(x, Bounds(cache.kAsmDouble)); 2506 CHECK_VAR(x, Bounds(cache.kAsmDouble));
2493 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); 2507 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
2494 } 2508 }
2495 } 2509 }
2496 } 2510 }
2497 CHECK_SKIP(); 2511 CHECK_SKIP();
2498 } 2512 }
2499 CHECK_FUNC_TYPES_END 2513 CHECK_FUNC_TYPES_END
2500 } 2514 }
OLDNEW
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698