| 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 <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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 TEST_BODY(kExprI32AsmjsLoadMem8U) \ | 230 TEST_BODY(kExprI32AsmjsLoadMem8U) \ |
| 231 TEST_BODY(kExprI32AsmjsLoadMem16S) \ | 231 TEST_BODY(kExprI32AsmjsLoadMem16S) \ |
| 232 TEST_BODY(kExprI32AsmjsLoadMem16U) \ | 232 TEST_BODY(kExprI32AsmjsLoadMem16U) \ |
| 233 TEST_BODY(kExprI32AsmjsLoadMem) | 233 TEST_BODY(kExprI32AsmjsLoadMem) |
| 234 | 234 |
| 235 #define FOREACH_INT_CHECKED_STORE_OP(TEST_BODY) \ | 235 #define FOREACH_INT_CHECKED_STORE_OP(TEST_BODY) \ |
| 236 TEST_BODY(kExprI32AsmjsStoreMem8) \ | 236 TEST_BODY(kExprI32AsmjsStoreMem8) \ |
| 237 TEST_BODY(kExprI32AsmjsStoreMem16) \ | 237 TEST_BODY(kExprI32AsmjsStoreMem16) \ |
| 238 TEST_BODY(kExprI32AsmjsStoreMem) | 238 TEST_BODY(kExprI32AsmjsStoreMem) |
| 239 | 239 |
| 240 #define INT_LOAD_TEST(OP_TYPE) \ | 240 #define INT_LOAD_TEST(OP_TYPE) \ |
| 241 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ | 241 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
| 242 TestingModule module(kExecuteCompiled); \ | 242 TestingModule module(kExecuteCompiled); \ |
| 243 module.origin = kAsmJsOrigin; \ | 243 module.origin = kAsmJsOrigin; \ |
| 244 WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ | 244 WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ |
| 245 BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ | 245 BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ |
| 246 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ | 246 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
| 247 RelocInfo::WASM_MEMORY_REFERENCE)); \ | 247 RelocInfo::WASM_MEMORY_REFERENCE)); \ |
| 248 CHECK_NE( \ | 248 CHECK_NE( \ |
| 249 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ | 249 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
| 250 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ | 250 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
| 251 } | 251 } |
| 252 | 252 |
| 253 FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) | 253 FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) |
| 254 | 254 |
| 255 #define INT_STORE_TEST(OP_TYPE) \ | 255 #define INT_STORE_TEST(OP_TYPE) \ |
| 256 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ | 256 TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ |
| 257 TestingModule module(kExecuteCompiled); \ | 257 TestingModule module(kExecuteCompiled); \ |
| 258 module.origin = kAsmJsOrigin; \ | 258 module.origin = kAsmJsOrigin; \ |
| 259 WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ | 259 WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ |
| 260 MachineType::Uint32()); \ | 260 MachineType::Uint32()); \ |
| 261 BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ | 261 BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ |
| 262 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ | 262 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
| 263 RelocInfo::WASM_MEMORY_REFERENCE)); \ | 263 RelocInfo::WASM_MEMORY_REFERENCE)); \ |
| 264 CHECK_NE( \ | 264 CHECK_NE( \ |
| 265 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ | 265 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ |
| 266 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ | 266 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ |
| 267 } | 267 } |
| 268 | 268 |
| 269 FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) | 269 FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) |
| 270 | 270 |
| 271 TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { | 271 TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { |
| 272 TestingModule module(kExecuteCompiled); | 272 TestingModule module(kExecuteCompiled); |
| 273 module.origin = kAsmJsOrigin; | 273 module.origin = kAsmJsOrigin; |
| 274 WasmRunner<float> r(&module, MachineType::Uint32()); | 274 WasmRunner<float> r(&module, MachineType::Uint32()); |
| 275 BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); | 275 BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); |
| 276 | 276 |
| 277 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 277 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 278 RelocInfo::WASM_MEMORY_REFERENCE)); | 278 RelocInfo::WASM_MEMORY_REFERENCE)); |
| 279 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], | 279 CHECK_NE(0u, |
| 280 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 280 GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 281 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
| 281 } | 282 } |
| 282 | 283 |
| 283 TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { | 284 TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { |
| 284 TestingModule module(kExecuteCompiled); | 285 TestingModule module(kExecuteCompiled); |
| 285 module.origin = kAsmJsOrigin; | 286 module.origin = kAsmJsOrigin; |
| 286 WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); | 287 WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); |
| 287 BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), | 288 BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), |
| 288 WASM_GET_LOCAL(1))); | 289 WASM_GET_LOCAL(1))); |
| 289 | 290 |
| 290 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 291 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 291 RelocInfo::WASM_MEMORY_REFERENCE)); | 292 RelocInfo::WASM_MEMORY_REFERENCE)); |
| 292 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], | 293 CHECK_NE(0u, |
| 293 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 294 GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 295 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
| 294 } | 296 } |
| 295 | 297 |
| 296 TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { | 298 TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { |
| 297 TestingModule module(kExecuteCompiled); | 299 TestingModule module(kExecuteCompiled); |
| 298 module.origin = kAsmJsOrigin; | 300 module.origin = kAsmJsOrigin; |
| 299 WasmRunner<double> r(&module, MachineType::Uint32()); | 301 WasmRunner<double> r(&module, MachineType::Uint32()); |
| 300 BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); | 302 BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); |
| 301 | 303 |
| 302 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 304 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 303 RelocInfo::WASM_MEMORY_REFERENCE)); | 305 RelocInfo::WASM_MEMORY_REFERENCE)); |
| 304 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], | 306 CHECK_NE(0u, |
| 305 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 307 GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 308 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
| 306 } | 309 } |
| 307 | 310 |
| 308 TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { | 311 TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { |
| 309 TestingModule module(kExecuteCompiled); | 312 TestingModule module(kExecuteCompiled); |
| 310 module.origin = kAsmJsOrigin; | 313 module.origin = kAsmJsOrigin; |
| 311 WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); | 314 WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); |
| 312 BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), | 315 BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), |
| 313 WASM_GET_LOCAL(1))); | 316 WASM_GET_LOCAL(1))); |
| 314 | 317 |
| 315 CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 318 CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 316 RelocInfo::WASM_MEMORY_REFERENCE)); | 319 RelocInfo::WASM_MEMORY_REFERENCE)); |
| 317 CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], | 320 CHECK_NE(0u, |
| 318 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); | 321 GetMatchingRelocInfoCount(module.instance->function_code[0], |
| 322 RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); |
| 319 } | 323 } |
| OLD | NEW |