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

Side by Side Diff: test/cctest/wasm/test-run-wasm.cc

Issue 1567853002: [wasm] OOB test should pass on all architectures. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 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 <stdint.h> 5 #include <stdint.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 10
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 memory[3] = 99999999; 1904 memory[3] = 99999999;
1905 CHECK_EQ(kWritten, r.Call(i * 4)); 1905 CHECK_EQ(kWritten, r.Call(i * 4));
1906 CHECK_EQ(66666666, memory[0]); 1906 CHECK_EQ(66666666, memory[0]);
1907 CHECK_EQ(i == 0 ? kWritten : 77777777, memory[1]); 1907 CHECK_EQ(i == 0 ? kWritten : 77777777, memory[1]);
1908 CHECK_EQ(i == 1 ? kWritten : 88888888, memory[2]); 1908 CHECK_EQ(i == 1 ? kWritten : 88888888, memory[2]);
1909 CHECK_EQ(i == 2 ? kWritten : 99999999, memory[3]); 1909 CHECK_EQ(i == 2 ? kWritten : 99999999, memory[3]);
1910 } 1910 }
1911 } 1911 }
1912 1912
1913 1913
1914 #if WASM_64
1915 // TODO(titzer): Figure out why this fails on 32-bit architectures.
1916 TEST(Run_Wasm_StoreMem_offset_oob) { 1914 TEST(Run_Wasm_StoreMem_offset_oob) {
1917 TestingModule module; 1915 TestingModule module;
1918 byte* memory = module.AddMemoryElems<byte>(32); 1916 byte* memory = module.AddMemoryElems<byte>(32);
1919 1917
1920 #if WASM_64 1918 #if WASM_64
1921 static const MachineType machineTypes[] = { 1919 static const MachineType machineTypes[] = {
1922 MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(), 1920 MachineType::Int8(), MachineType::Uint8(), MachineType::Int16(),
1923 MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(), 1921 MachineType::Uint16(), MachineType::Int32(), MachineType::Uint32(),
1924 MachineType::Int64(), MachineType::Uint64(), MachineType::Float32(), 1922 MachineType::Int64(), MachineType::Uint64(), MachineType::Float32(),
1925 MachineType::Float64()}; 1923 MachineType::Float64()};
(...skipping 16 matching lines...) Expand all
1942 byte memsize = WasmOpcodes::MemSize(machineTypes[m]); 1940 byte memsize = WasmOpcodes::MemSize(machineTypes[m]);
1943 uint32_t boundary = 24 - memsize; 1941 uint32_t boundary = 24 - memsize;
1944 CHECK_EQ(0, r.Call(boundary)); // in bounds. 1942 CHECK_EQ(0, r.Call(boundary)); // in bounds.
1945 CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize)); 1943 CHECK_EQ(0, memcmp(&memory[0], &memory[8 + boundary], memsize));
1946 1944
1947 for (uint32_t offset = boundary + 1; offset < boundary + 19; offset++) { 1945 for (uint32_t offset = boundary + 1; offset < boundary + 19; offset++) {
1948 CHECK_TRAP(r.Call(offset)); // out of bounds. 1946 CHECK_TRAP(r.Call(offset)); // out of bounds.
1949 } 1947 }
1950 } 1948 }
1951 } 1949 }
1952 #endif
1953 1950
1954 1951
1955 #if WASM_64 1952 #if WASM_64
1956 TEST(Run_Wasm_F64ReinterpretI64) { 1953 TEST(Run_Wasm_F64ReinterpretI64) {
1957 WasmRunner<int64_t> r; 1954 WasmRunner<int64_t> r;
1958 TestingModule module; 1955 TestingModule module;
1959 int64_t* memory = module.AddMemoryElems<int64_t>(8); 1956 int64_t* memory = module.AddMemoryElems<int64_t>(8);
1960 r.env()->module = &module; 1957 r.env()->module = &module;
1961 1958
1962 BUILD(r, WASM_I64_REINTERPRET_F64( 1959 BUILD(r, WASM_I64_REINTERPRET_F64(
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 TEST(Run_Wasm_F32CopySign) { 3564 TEST(Run_Wasm_F32CopySign) {
3568 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); 3565 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
3569 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 3566 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
3570 3567
3571 FOR_FLOAT32_INPUTS(i) { 3568 FOR_FLOAT32_INPUTS(i) {
3572 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } 3569 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); }
3573 } 3570 }
3574 } 3571 }
3575 3572
3576 #endif 3573 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698