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

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

Issue 1722473002: Allow intish and floatish to be coerced by heap assignment. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge Created 4 years, 10 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') | 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 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 } 1427 }
1428 } 1428 }
1429 } 1429 }
1430 } 1430 }
1431 } 1431 }
1432 CHECK_SKIP(); 1432 CHECK_SKIP();
1433 } 1433 }
1434 CHECK_FUNC_TYPES_END 1434 CHECK_FUNC_TYPES_END
1435 } 1435 }
1436 1436
1437 TEST(StoreIntish) {
1438 CHECK_FUNC_TYPES_BEGIN(
1439 "function bar() { var x = 1; var y = 1; i32[0] = x + y; }\n"
1440 "function foo() { bar(); }") {
1441 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1442 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1443 CHECK_VAR(x, Bounds(cache.kAsmInt));
1444 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1445 }
1446 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1447 CHECK_VAR(y, Bounds(cache.kAsmInt));
1448 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1449 }
1450 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1451 CHECK_EXPR(Property, Bounds::Unbounded()) {
1452 CHECK_VAR(i32, Bounds(cache.kInt32Array));
1453 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1454 }
1455 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) {
1456 CHECK_VAR(x, Bounds(cache.kAsmInt));
1457 CHECK_VAR(y, Bounds(cache.kAsmInt));
1458 }
1459 }
1460 }
1461 CHECK_SKIP();
1462 }
1463 CHECK_FUNC_TYPES_END
1464 }
1465
1466 TEST(StoreFloatish) {
1467 CHECK_FUNC_TYPES_BEGIN(
1468 "function bar() { "
1469 "var x = fround(1.0); "
1470 "var y = fround(1.0); f32[0] = x + y; }\n"
1471 "function foo() { bar(); }") {
1472 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1473 CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) {
1474 CHECK_VAR(x, Bounds(cache.kAsmFloat));
1475 CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) {
1476 CHECK_VAR(fround, FUNC_N2F_TYPE);
1477 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
1478 }
1479 }
1480 CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) {
1481 CHECK_VAR(y, Bounds(cache.kAsmFloat));
1482 CHECK_EXPR(Call, Bounds(cache.kAsmFloat)) {
1483 CHECK_VAR(fround, FUNC_N2F_TYPE);
1484 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble));
1485 }
1486 }
1487 CHECK_EXPR(Assignment, Bounds(cache.kAsmFloat)) {
1488 CHECK_EXPR(Property, Bounds::Unbounded()) {
1489 CHECK_VAR(f32, Bounds(cache.kFloat32Array));
1490 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1491 }
1492 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmFloat)) {
1493 CHECK_VAR(x, Bounds(cache.kAsmFloat));
1494 CHECK_VAR(y, Bounds(cache.kAsmFloat));
1495 }
1496 }
1497 }
1498 CHECK_SKIP();
1499 }
1500 CHECK_FUNC_TYPES_END
1501 }
1437 1502
1438 TEST(Load1Constant) { 1503 TEST(Load1Constant) {
1439 CHECK_FUNC_TYPES_BEGIN( 1504 CHECK_FUNC_TYPES_BEGIN(
1440 "function bar() { var x = 1; var y = i8[5]|0; }\n" 1505 "function bar() { var x = 1; var y = i8[5]|0; }\n"
1441 "function foo() { bar(); }") { 1506 "function foo() { bar(); }") {
1442 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { 1507 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
1443 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { 1508 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
1444 CHECK_VAR(x, Bounds(cache.kAsmInt)); 1509 CHECK_VAR(x, Bounds(cache.kAsmInt));
1445 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); 1510 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
1446 } 1511 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 CHECK_FUNC_ERROR( 1770 CHECK_FUNC_ERROR(
1706 "function bar() {\n" 1771 "function bar() {\n"
1707 " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n" 1772 " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n"
1708 "function foo() { bar(); }", 1773 "function foo() { bar(); }",
1709 "asm: line 40: return type does not match function signature\n"); 1774 "asm: line 40: return type does not match function signature\n");
1710 } 1775 }
1711 1776
1712 1777
1713 TEST(AssignToFloatishToF64) { 1778 TEST(AssignToFloatishToF64) {
1714 CHECK_FUNC_ERROR( 1779 CHECK_FUNC_ERROR(
1715 "function bar() { var v = fround(1.0); f32[0] = v + fround(1.0); }\n" 1780 "function bar() { var v = fround(1.0); f64[0] = v + fround(1.0); }\n"
1716 "function foo() { bar(); }", 1781 "function foo() { bar(); }",
1717 "asm: line 39: intish or floatish assignment\n"); 1782 "asm: line 39: floatish assignment to double array\n");
1718 } 1783 }
1719 1784
1720 1785
1721 TEST(ForeignFunction) { 1786 TEST(ForeignFunction) {
1722 CHECK_FUNC_TYPES_BEGIN( 1787 CHECK_FUNC_TYPES_BEGIN(
1723 "var baz = foreign.baz;\n" 1788 "var baz = foreign.baz;\n"
1724 "function bar() { return baz(1, 2)|0; }\n" 1789 "function bar() { return baz(1, 2)|0; }\n"
1725 "function foo() { bar(); }") { 1790 "function foo() { bar(); }") {
1726 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { 1791 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) {
1727 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { 1792 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 } 2335 }
2271 // return { testFunc1: test1, testFunc2: test2 }; 2336 // return { testFunc1: test1, testFunc2: test2 };
2272 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { 2337 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) {
2273 CHECK_VAR(test1, FUNC_I_TYPE); 2338 CHECK_VAR(test1, FUNC_I_TYPE);
2274 CHECK_VAR(test2, FUNC_D_TYPE); 2339 CHECK_VAR(test2, FUNC_D_TYPE);
2275 } 2340 }
2276 } 2341 }
2277 } 2342 }
2278 CHECK_TYPES_END 2343 CHECK_TYPES_END
2279 } 2344 }
OLDNEW
« no previous file with comments | « src/typing-asm.cc ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698