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

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

Issue 2138243002: [wasm] allow array access with unsigned indices (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] allow array access with unsigned indices Created 4 years, 5 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/asmjs/typing-asm.cc ('k') | test/mjsunit/regress/regress-618608.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/asmjs/typing-asm.h" 7 #include "src/asmjs/typing-asm.h"
8 #include "src/ast/ast-expression-visitor.h" 8 #include "src/ast/ast-expression-visitor.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // sum = sum + +log(values[p>>3]); 196 // sum = sum + +log(values[p>>3]);
197 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { 197 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) {
198 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); 198 CHECK_VAR(sum, Bounds(cache.kAsmDouble));
199 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 199 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
200 CHECK_VAR(sum, Bounds(cache.kAsmDouble)); 200 CHECK_VAR(sum, Bounds(cache.kAsmDouble));
201 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 201 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
202 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) { 202 CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) {
203 CHECK_VAR(log, FUNC_D2D_TYPE); 203 CHECK_VAR(log, FUNC_D2D_TYPE);
204 CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) { 204 CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) {
205 CHECK_VAR(values, FLOAT64_ARRAY_TYPE); 205 CHECK_VAR(values, FLOAT64_ARRAY_TYPE);
206 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 206 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
207 CHECK_VAR(p, Bounds(cache.kAsmSigned)); 207 CHECK_VAR(p, Bounds(cache.kAsmInt));
208 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 208 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
209 } 209 }
210 } 210 }
211 } 211 }
212 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); 212 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
213 } 213 }
214 } 214 }
215 } 215 }
216 // return +sum; 216 // return +sum;
217 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 217 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 1446 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1447 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1447 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1448 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1448 CHECK_VAR(x, Bounds(cache.kAsmInt));
1449 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1449 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1450 } 1450 }
1451 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1451 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1452 CHECK_VAR(y, Bounds(cache.kAsmInt)); 1452 CHECK_VAR(y, Bounds(cache.kAsmInt));
1453 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 1453 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
1454 CHECK_EXPR(Property, Bounds(cache.kAsmInt)) { 1454 CHECK_EXPR(Property, Bounds(cache.kAsmInt)) {
1455 CHECK_VAR(i8, Bounds(cache.kInt8Array)); 1455 CHECK_VAR(i8, Bounds(cache.kInt8Array));
1456 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 1456 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
1457 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1457 CHECK_VAR(x, Bounds(cache.kAsmInt));
1458 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1458 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1459 } 1459 }
1460 } 1460 }
1461 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1461 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1462 } 1462 }
1463 } 1463 }
1464 } 1464 }
1465 CHECK_SKIP(); 1465 CHECK_SKIP();
1466 } 1466 }
(...skipping 12 matching lines...) Expand all
1479 } 1479 }
1480 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { 1480 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) {
1481 CHECK_VAR(y, Bounds(cache.kAsmDouble)); 1481 CHECK_VAR(y, Bounds(cache.kAsmDouble));
1482 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); 1482 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
1483 } 1483 }
1484 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) { 1484 CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) {
1485 CHECK_VAR(y, Bounds(cache.kAsmDouble)); 1485 CHECK_VAR(y, Bounds(cache.kAsmDouble));
1486 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 1486 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
1487 CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) { 1487 CHECK_EXPR(Property, Bounds(cache.kAsmDouble)) {
1488 CHECK_VAR(f64, Bounds(cache.kFloat64Array)); 1488 CHECK_VAR(f64, Bounds(cache.kFloat64Array));
1489 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 1489 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
1490 CHECK_VAR(x, Bounds(cache.kAsmSigned)); 1490 CHECK_VAR(x, Bounds(cache.kAsmInt));
1491 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1491 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1492 } 1492 }
1493 } 1493 }
1494 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); 1494 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
1495 } 1495 }
1496 } 1496 }
1497 } 1497 }
1498 CHECK_SKIP(); 1498 CHECK_SKIP();
1499 } 1499 }
1500 CHECK_FUNC_TYPES_END 1500 CHECK_FUNC_TYPES_END
1501 } 1501 }
1502 1502
1503 1503
1504 TEST(Store1) { 1504 TEST(Store1) {
1505 CHECK_FUNC_TYPES_BEGIN( 1505 CHECK_FUNC_TYPES_BEGIN(
1506 "function bar() { var x = 1; i8[x>>0] = 0; }\n" 1506 "function bar() { var x = 1; i8[x>>0] = 0; }\n"
1507 "function foo() { bar(); }") { 1507 "function foo() { bar(); }") {
1508 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 1508 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1509 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1509 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1510 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1510 CHECK_VAR(x, Bounds(cache.kAsmInt));
1511 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1511 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1512 } 1512 }
1513 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1513 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1514 CHECK_EXPR(Property, Bounds::Unbounded()) { 1514 CHECK_EXPR(Property, Bounds::Unbounded()) {
1515 CHECK_VAR(i8, Bounds(cache.kInt8Array)); 1515 CHECK_VAR(i8, Bounds(cache.kInt8Array));
1516 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 1516 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
1517 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1517 CHECK_VAR(x, Bounds(cache.kAsmInt));
1518 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1518 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1519 } 1519 }
1520 } 1520 }
1521 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1521 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1522 } 1522 }
1523 } 1523 }
1524 CHECK_SKIP(); 1524 CHECK_SKIP();
1525 } 1525 }
1526 CHECK_FUNC_TYPES_END 1526 CHECK_FUNC_TYPES_END
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 "function bar() { var x = 0; i8[x] = 2; }\n" 1955 "function bar() { var x = 0; i8[x] = 2; }\n"
1956 "function foo() { bar(); }") { 1956 "function foo() { bar(); }") {
1957 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 1957 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1958 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1958 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1959 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1959 CHECK_VAR(x, Bounds(cache.kAsmInt));
1960 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1960 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1961 } 1961 }
1962 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1962 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1963 CHECK_EXPR(Property, Bounds::Unbounded()) { 1963 CHECK_EXPR(Property, Bounds::Unbounded()) {
1964 CHECK_VAR(i8, Bounds(cache.kInt8Array)); 1964 CHECK_VAR(i8, Bounds(cache.kInt8Array));
1965 CHECK_VAR(x, Bounds(cache.kAsmSigned)); 1965 CHECK_VAR(x, Bounds(cache.kAsmUnsigned));
1966 } 1966 }
1967 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1967 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1968 } 1968 }
1969 } 1969 }
1970 CHECK_SKIP(); 1970 CHECK_SKIP();
1971 } 1971 }
1972 CHECK_FUNC_TYPES_END 1972 CHECK_FUNC_TYPES_END
1973 } 1973 }
1974 1974
1975 TEST(BadExports) { 1975 TEST(BadExports) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 "function bar() { var x = 0; i8[(x = 1) >> 0] = 2; }\n" 2070 "function bar() { var x = 0; i8[(x = 1) >> 0] = 2; }\n"
2071 "function foo() { bar(); }") { 2071 "function foo() { bar(); }") {
2072 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 2072 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
2073 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 2073 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
2074 CHECK_VAR(x, Bounds(cache.kAsmInt)); 2074 CHECK_VAR(x, Bounds(cache.kAsmInt));
2075 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 2075 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
2076 } 2076 }
2077 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 2077 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
2078 CHECK_EXPR(Property, Bounds::Unbounded()) { 2078 CHECK_EXPR(Property, Bounds::Unbounded()) {
2079 CHECK_VAR(i8, Bounds(cache.kInt8Array)); 2079 CHECK_VAR(i8, Bounds(cache.kInt8Array));
2080 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 2080 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
2081 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 2081 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
2082 CHECK_VAR(x, Bounds(cache.kAsmInt)); 2082 CHECK_VAR(x, Bounds(cache.kAsmInt));
2083 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 2083 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
2084 } 2084 }
2085 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 2085 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
2086 } 2086 }
2087 } 2087 }
2088 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 2088 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
2089 } 2089 }
2090 } 2090 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { 2547 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
2548 CHECK_VAR(x, Bounds(cache.kAsmDouble)); 2548 CHECK_VAR(x, Bounds(cache.kAsmDouble));
2549 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); 2549 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
2550 } 2550 }
2551 } 2551 }
2552 } 2552 }
2553 CHECK_SKIP(); 2553 CHECK_SKIP();
2554 } 2554 }
2555 CHECK_FUNC_TYPES_END 2555 CHECK_FUNC_TYPES_END
2556 } 2556 }
OLDNEW
« no previous file with comments | « src/asmjs/typing-asm.cc ('k') | test/mjsunit/regress/regress-618608.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698