OLD | NEW |
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/wasm/wasm-macro-gen.h" | 9 #include "src/wasm/wasm-macro-gen.h" |
10 | 10 |
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), | 2466 WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), |
2467 WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), | 2467 WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), |
2468 WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), | 2468 WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), |
2469 WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), | 2469 WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), |
2470 WASM_F64(256.5), WASM_F64(512.5))); | 2470 WASM_F64(256.5), WASM_F64(512.5))); |
2471 | 2471 |
2472 float result = r.Call(); | 2472 float result = r.Call(); |
2473 CHECK_EQ(256.5, result); | 2473 CHECK_EQ(256.5, result); |
2474 } | 2474 } |
2475 | 2475 |
| 2476 TEST(Run_WasmCallI64Parameter) { |
| 2477 // Build the target function. |
| 2478 LocalType param_types[20]; |
| 2479 for (int i = 0; i < 20; i++) param_types[i] = kAstI64; |
| 2480 param_types[3] = kAstI32; |
| 2481 param_types[4] = kAstI32; |
| 2482 FunctionSig sig(1, 19, param_types); |
| 2483 for (int i = 0; i < 19; i++) { |
| 2484 TestingModule module; |
| 2485 WasmFunctionCompiler t(&sig); |
| 2486 if (i == 2 || i == 3) { |
| 2487 continue; |
| 2488 } else { |
| 2489 BUILD(t, WASM_GET_LOCAL(i)); |
| 2490 } |
| 2491 uint32_t index = t.CompileAndAdd(&module); |
| 2492 |
| 2493 // Build the calling function. |
| 2494 WasmRunner<int32_t> r; |
| 2495 r.env()->module = &module; |
| 2496 BUILD(r, WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION( |
| 2497 index, WASM_I64(11), WASM_I64(12), WASM_I32(13), |
| 2498 WASM_I32_CONVERT_I64(WASM_I64(14)), WASM_I64(15), WASM_I64(16), |
| 2499 WASM_I64(17), WASM_I64(18), WASM_I64(19), WASM_I64(20), |
| 2500 WASM_I64(21), WASM_I64(22), WASM_I64(23), WASM_I64(24), |
| 2501 WASM_I64(25), WASM_I64(26), WASM_I64(27), WASM_I64(28), |
| 2502 WASM_I64(29)))); |
| 2503 |
| 2504 CHECK_EQ(i + 11, r.Call()); |
| 2505 } |
| 2506 } |
| 2507 |
| 2508 TEST(Run_WasmI64And) { |
| 2509 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 2510 BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 2511 FOR_INT64_INPUTS(i) { |
| 2512 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); } |
| 2513 } |
| 2514 } |
2476 | 2515 |
2477 TEST(Run_WasmCallVoid) { | 2516 TEST(Run_WasmCallVoid) { |
2478 const byte kMemOffset = 8; | 2517 const byte kMemOffset = 8; |
2479 const int32_t kElemNum = kMemOffset / sizeof(int32_t); | 2518 const int32_t kElemNum = kMemOffset / sizeof(int32_t); |
2480 const int32_t kExpected = -414444; | 2519 const int32_t kExpected = -414444; |
2481 // Build the target function. | 2520 // Build the target function. |
2482 TestSignatures sigs; | 2521 TestSignatures sigs; |
2483 TestingModule module; | 2522 TestingModule module; |
2484 module.AddMemory(16); | 2523 module.AddMemory(16); |
2485 module.RandomizeMemory(); | 2524 module.RandomizeMemory(); |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 | 3474 |
3436 #if WASM_64 | 3475 #if WASM_64 |
3437 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3476 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3438 #endif | 3477 #endif |
3439 | 3478 |
3440 | 3479 |
3441 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3480 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3442 | 3481 |
3443 | 3482 |
3444 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3483 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |