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

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

Issue 1578963003: Enforce asm restrictions on switch more precisely. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix 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 unified diff | Download patch
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | 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 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); 2017 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned));
2018 // default: return 66; 2018 // default: return 66;
2019 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); 2019 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned));
2020 // return 0; 2020 // return 0;
2021 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned)); 2021 CHECK_EXPR(Literal, Bounds(cache.kAsmSigned));
2022 } 2022 }
2023 CHECK_SKIP(); 2023 CHECK_SKIP();
2024 } 2024 }
2025 CHECK_FUNC_TYPES_END 2025 CHECK_FUNC_TYPES_END
2026 } 2026 }
2027
2028
2029 TEST(BadSwitchRange) {
2030 CHECK_FUNC_ERROR(
2031 "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n"
2032 "function foo() { bar(); }",
2033 "asm: line 39: case range too large\n");
2034 }
2035
2036
2037 TEST(DuplicateSwitchCase) {
2038 CHECK_FUNC_ERROR(
2039 "function bar() { switch (1) { case 0: case 0: } }\n"
2040 "function foo() { bar(); }",
2041 "asm: line 39: duplicate case value\n");
2042 }
2043
2044
2045 TEST(BadSwitchOrder) {
2046 CHECK_FUNC_ERROR(
2047 "function bar() { switch (1) { default: case 0: } }\n"
2048 "function foo() { bar(); }",
2049 "asm: line 39: default case out of order\n");
2050 }
OLDNEW
« 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