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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 // Build the calling function. | 2371 // Build the calling function. |
2372 WasmRunner<int32_t> r; | 2372 WasmRunner<int32_t> r; |
2373 r.env()->module = &module; | 2373 r.env()->module = &module; |
2374 BUILD(r, WASM_CALL_FUNCTION0(index)); | 2374 BUILD(r, WASM_CALL_FUNCTION0(index)); |
2375 | 2375 |
2376 int32_t result = r.Call(); | 2376 int32_t result = r.Call(); |
2377 CHECK_EQ(kExpected, result); | 2377 CHECK_EQ(kExpected, result); |
2378 } | 2378 } |
2379 | 2379 |
2380 | 2380 |
2381 // TODO(tizer): Fix on arm and reenable. | |
2382 #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 | |
2383 | |
2384 TEST(Run_WasmCallF32StackParameter) { | 2381 TEST(Run_WasmCallF32StackParameter) { |
2385 // Build the target function. | 2382 // Build the target function. |
2386 LocalType param_types[20]; | 2383 LocalType param_types[20]; |
2387 for (int i = 0; i < 20; i++) param_types[i] = kAstF32; | 2384 for (int i = 0; i < 20; i++) param_types[i] = kAstF32; |
2388 FunctionSig sig(1, 19, param_types); | 2385 FunctionSig sig(1, 19, param_types); |
2389 TestingModule module; | 2386 TestingModule module; |
2390 WasmFunctionCompiler t(&sig); | 2387 WasmFunctionCompiler t(&sig); |
2391 BUILD(t, WASM_GET_LOCAL(17)); | 2388 BUILD(t, WASM_GET_LOCAL(17)); |
2392 uint32_t index = t.CompileAndAdd(&module); | 2389 uint32_t index = t.CompileAndAdd(&module); |
2393 | 2390 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), | 2422 WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), |
2426 WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), | 2423 WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), |
2427 WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), | 2424 WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), |
2428 WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), | 2425 WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), |
2429 WASM_F64(256.5), WASM_F64(512.5))); | 2426 WASM_F64(256.5), WASM_F64(512.5))); |
2430 | 2427 |
2431 float result = r.Call(); | 2428 float result = r.Call(); |
2432 CHECK_EQ(256.5, result); | 2429 CHECK_EQ(256.5, result); |
2433 } | 2430 } |
2434 | 2431 |
2435 #endif | |
2436 | |
2437 | 2432 |
2438 TEST(Run_WasmCallVoid) { | 2433 TEST(Run_WasmCallVoid) { |
2439 const byte kMemOffset = 8; | 2434 const byte kMemOffset = 8; |
2440 const int32_t kElemNum = kMemOffset / sizeof(int32_t); | 2435 const int32_t kElemNum = kMemOffset / sizeof(int32_t); |
2441 const int32_t kExpected = -414444; | 2436 const int32_t kExpected = -414444; |
2442 // Build the target function. | 2437 // Build the target function. |
2443 TestSignatures sigs; | 2438 TestSignatures sigs; |
2444 TestingModule module; | 2439 TestingModule module; |
2445 module.AddMemory(16); | 2440 module.AddMemory(16); |
2446 module.RandomizeMemory(); | 2441 module.RandomizeMemory(); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 | 3315 |
3321 #if WASM_64 | 3316 #if WASM_64 |
3322 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3317 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3323 #endif | 3318 #endif |
3324 | 3319 |
3325 | 3320 |
3326 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3321 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3327 | 3322 |
3328 | 3323 |
3329 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3324 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |