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

Side by Side Diff: test/cctest/asmjs/test-asm-typer.cc

Issue 2481103002: [wasm] [asm.js] Don't allow bad return types from a global constant (Closed)
Patch Set: Created 4 years, 1 month 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/asm-typer.cc ('k') | test/mjsunit/asm/asm-validation.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 <cstring> 5 #include <cstring>
6 #include <functional> 6 #include <functional>
7 #include <iostream> 7 #include <iostream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-typer.h" 10 #include "src/asmjs/asm-typer.h"
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 }; 2019 };
2020 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { 2020 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
2021 if (!ValidationOf(Module(kTests[ii])) 2021 if (!ValidationOf(Module(kTests[ii]))
2022 ->FailsWithMessage("Can't assign to immutable symbol")) { 2022 ->FailsWithMessage("Can't assign to immutable symbol")) {
2023 std::cerr << "Test:\n" << kTests[ii]; 2023 std::cerr << "Test:\n" << kTests[ii];
2024 CHECK(false); 2024 CHECK(false);
2025 } 2025 }
2026 } 2026 }
2027 } 2027 }
2028 2028
2029 TEST(B660813) {
2030 const char* kTests[] = {
2031 "function asm() {\n"
2032 " 'use asm';\n"
2033 " const i = 0xffffffff;\n"
2034 " function f() {\n"
2035 " return i;\n"
2036 " }\n"
2037 "}",
2038 "function asm() {\n"
2039 " 'use asm';\n"
2040 " const i = -(-2147483648);\n"
2041 " function f() {\n"
2042 " return i;\n"
2043 " }\n"
2044 "}",
2045 };
2046 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
2047 if (!ValidationOf(Module(kTests[ii]))
2048 ->FailsWithMessage(
2049 "Constant in return must be signed, float, or double.")) {
2050 std::cerr << "Test:\n" << kTests[ii];
2051 CHECK(false);
2052 }
2053 }
2054 }
2055
2029 } // namespace 2056 } // namespace
OLDNEW
« 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