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

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

Issue 2061833003: [wasm] Support for memory size relocation for asm-wasm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/ia32/macro-assembler-ia32.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 <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/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 TEST_BODY(kExprI32AsmjsStoreMem16) \ 221 TEST_BODY(kExprI32AsmjsStoreMem16) \
222 TEST_BODY(kExprI32AsmjsStoreMem) 222 TEST_BODY(kExprI32AsmjsStoreMem)
223 223
224 #define INT_LOAD_TEST(OP_TYPE) \ 224 #define INT_LOAD_TEST(OP_TYPE) \
225 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ 225 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \
226 TestingModule module(kExecuteCompiled); \ 226 TestingModule module(kExecuteCompiled); \
227 WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ 227 WasmRunner<int32_t> r(&module, MachineType::Uint32()); \
228 BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ 228 BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \
229 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ 229 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \
230 RelocInfo::WASM_MEMORY_REFERENCE)); \ 230 RelocInfo::WASM_MEMORY_REFERENCE)); \
231 CHECK_NE( \
232 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \
233 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \
231 } 234 }
232 235
233 FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) 236 FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST)
234 237
235 #define INT_STORE_TEST(OP_TYPE) \ 238 #define INT_STORE_TEST(OP_TYPE) \
236 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ 239 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \
237 TestingModule module(kExecuteCompiled); \ 240 TestingModule module(kExecuteCompiled); \
238 WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ 241 WasmRunner<int32_t> r(&module, MachineType::Uint32(), \
239 MachineType::Uint32()); \ 242 MachineType::Uint32()); \
240 BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ 243 BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \
241 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ 244 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \
242 RelocInfo::WASM_MEMORY_REFERENCE)); \ 245 RelocInfo::WASM_MEMORY_REFERENCE)); \
246 CHECK_NE( \
247 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \
248 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \
243 } 249 }
244 250
245 FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) 251 FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST)
246 252
247 TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { 253 TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) {
248 TestingModule module(kExecuteCompiled); 254 TestingModule module(kExecuteCompiled);
249 WasmRunner<float_t> r(&module, MachineType::Uint32()); 255 WasmRunner<float_t> r(&module, MachineType::Uint32());
250 BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); 256 BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0)));
251 257
252 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], 258 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
253 RelocInfo::WASM_MEMORY_REFERENCE)); 259 RelocInfo::WASM_MEMORY_REFERENCE));
260 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0],
261 RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
254 } 262 }
255 263
256 TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { 264 TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) {
257 TestingModule module(kExecuteCompiled); 265 TestingModule module(kExecuteCompiled);
258 WasmRunner<float_t> r(&module, MachineType::Uint32(), MachineType::Float32()); 266 WasmRunner<float_t> r(&module, MachineType::Uint32(), MachineType::Float32());
259 BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), 267 BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0),
260 WASM_GET_LOCAL(1))); 268 WASM_GET_LOCAL(1)));
261 269
262 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], 270 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
263 RelocInfo::WASM_MEMORY_REFERENCE)); 271 RelocInfo::WASM_MEMORY_REFERENCE));
272 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0],
273 RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
264 } 274 }
265 275
266 TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { 276 TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) {
267 TestingModule module(kExecuteCompiled); 277 TestingModule module(kExecuteCompiled);
268 WasmRunner<double_t> r(&module, MachineType::Uint32()); 278 WasmRunner<double_t> r(&module, MachineType::Uint32());
269 BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); 279 BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0)));
270 280
271 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], 281 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
272 RelocInfo::WASM_MEMORY_REFERENCE)); 282 RelocInfo::WASM_MEMORY_REFERENCE));
283 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0],
284 RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
273 } 285 }
274 286
275 TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { 287 TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) {
276 TestingModule module(kExecuteCompiled); 288 TestingModule module(kExecuteCompiled);
277 WasmRunner<double_t> r(&module, MachineType::Uint32(), 289 WasmRunner<double_t> r(&module, MachineType::Uint32(),
278 MachineType::Float64()); 290 MachineType::Float64());
279 BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), 291 BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0),
280 WASM_GET_LOCAL(1))); 292 WASM_GET_LOCAL(1)));
281 293
282 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], 294 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
283 RelocInfo::WASM_MEMORY_REFERENCE)); 295 RelocInfo::WASM_MEMORY_REFERENCE));
296 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0],
297 RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
284 } 298 }
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698