OLD | NEW |
---|---|
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 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1934 | 1934 |
1935 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1935 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
1936 if (!ValidationOf(Module(kTests[ii])) | 1936 if (!ValidationOf(Module(kTests[ii])) |
1937 ->FailsWithMessage("Invalid heap access index")) { | 1937 ->FailsWithMessage("Invalid heap access index")) { |
1938 std::cerr << "Test:\n" << kTests[ii]; | 1938 std::cerr << "Test:\n" << kTests[ii]; |
1939 CHECK(false); | 1939 CHECK(false); |
1940 } | 1940 } |
1941 } | 1941 } |
1942 } | 1942 } |
1943 | 1943 |
1944 // This issue was triggered because assignment to special symbosl (i.e., the | |
titzer
2016/08/23 13:58:25
s/assignment to special symbosl/a special symbol/
John
2016/08/23 14:02:32
I rephrased slightly differently: intead of "speci
| |
1945 // module's name, or any of the asm.js' module parameters) was assigned to. | |
1946 TEST(B640194) { | |
1947 const char* kTests[] = { | |
1948 "function asm() {\n" | |
1949 " 'use asm';\n" | |
1950 " function f() {\n" | |
1951 " asm = 0;\n" | |
1952 " }\n" | |
1953 " return f;\n" | |
1954 "}", | |
1955 "function asm(stdlib) {\n" | |
1956 " 'use asm';\n" | |
1957 " function f() {\n" | |
1958 " stdlib = 0;\n" | |
1959 " }\n" | |
1960 " return f;\n" | |
1961 "}", | |
1962 "function asm(stdlib, foreign) {\n" | |
1963 " 'use asm';\n" | |
1964 " function f() {\n" | |
1965 " foreign = 0;\n" | |
1966 " }\n" | |
1967 " return f;\n" | |
1968 "}", | |
1969 "function asm(stdlib, foreign, heap) {\n" | |
1970 " 'use asm';\n" | |
1971 " function f() {\n" | |
1972 " heap = 0;\n" | |
1973 " }\n" | |
1974 " return f;\n" | |
1975 "}", | |
1976 "function asm(stdlib, foreign, heap) {\n" | |
1977 " 'use asm';\n" | |
1978 " var f = stdlib.Math.fround;\n" | |
1979 " function f() {\n" | |
1980 " f = 0;\n" | |
1981 " }\n" | |
1982 " return f;\n" | |
1983 "}", | |
1984 "function asm(stdlib, foreign, heap) {\n" | |
1985 " 'use asm';\n" | |
1986 " var E = stdlib.Math.E;\n" | |
1987 " function f() {\n" | |
1988 " E = 0;\n" | |
1989 " }\n" | |
1990 " return f;\n" | |
1991 "}", | |
1992 }; | |
1993 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | |
1994 if (!ValidationOf(Module(kTests[ii])) | |
1995 ->FailsWithMessage("Can't assign to immutable symbol")) { | |
1996 std::cerr << "Test:\n" << kTests[ii]; | |
1997 CHECK(false); | |
1998 } | |
1999 } | |
2000 } | |
2001 | |
1944 } // namespace | 2002 } // namespace |
OLD | NEW |