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

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

Issue 2181723002: [wasm][asm2wasm] Fixes a bug in 8-bit heap view accesses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/asm-typer.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 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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 1901
1902 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { 1902 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
1903 if (!ValidationOf(Module(kTests[ii])) 1903 if (!ValidationOf(Module(kTests[ii]))
1904 ->FailsWithMessage("Invalid asm.js source code layout")) { 1904 ->FailsWithMessage("Invalid asm.js source code layout")) {
1905 std::cerr << "Test:\n" << kTests[ii]; 1905 std::cerr << "Test:\n" << kTests[ii];
1906 CHECK(false); 1906 CHECK(false);
1907 } 1907 }
1908 } 1908 }
1909 } 1909 }
1910 1910
1911 // This issue was triggered because of the "lenient" 8-bit heap access code
1912 // path. The canonical heap access index validation fails because __34 is not an
1913 // intish. Then, during the "lenient" code path for accessing elements in 8-bit
1914 // heap views, the __34 node in the indexing expression would be re-tagged, thus
1915 // causing the assertion failure.
1916 TEST(B63099) {
1917 const char* kTests[] = {
1918 "function __f_109(stdlib, __v_36, buffer) {\n"
1919 " 'use asm';\n"
1920 " var __v_34 = new stdlib.Uint8Array(buffer);\n"
1921 " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n"
1922 " }\n"
1923 "}",
1924 "function __f_109(stdlib, __v_36, buffer) {\n"
1925 " 'use asm';\n"
1926 " var __v_34 = new stdlib.Int8Array(buffer);\n"
1927 " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n"
1928 " }\n"
1929 "}",
1930 };
1931
1932 for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
1933 if (!ValidationOf(Module(kTests[ii]))
1934 ->FailsWithMessage("Invalid heap access index")) {
1935 std::cerr << "Test:\n" << kTests[ii];
1936 CHECK(false);
1937 }
1938 }
1939 }
1940
1911 } // namespace 1941 } // namespace
OLDNEW
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698