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 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3268 | 3268 |
3269 TEST(Run_Wasm_F32CopySign) { | 3269 TEST(Run_Wasm_F32CopySign) { |
3270 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); | 3270 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); |
3271 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 3271 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
3272 | 3272 |
3273 FOR_FLOAT32_INPUTS(i) { | 3273 FOR_FLOAT32_INPUTS(i) { |
3274 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } | 3274 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } |
3275 } | 3275 } |
3276 } | 3276 } |
3277 | 3277 |
| 3278 |
3278 #endif | 3279 #endif |
| 3280 |
| 3281 |
| 3282 void CompileCallIndirectMany(LocalType param) { |
| 3283 // Make sure we don't run out of registers when compiling indirect calls |
| 3284 // with many many parameters. |
| 3285 TestSignatures sigs; |
| 3286 for (byte num_params = 0; num_params < 40; num_params++) { |
| 3287 Zone zone; |
| 3288 HandleScope scope(CcTest::InitIsolateOnce()); |
| 3289 TestingModule module; |
| 3290 FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); |
| 3291 |
| 3292 module.AddSignature(sig); |
| 3293 module.AddSignature(sig); |
| 3294 module.AddIndirectFunctionTable(nullptr, 0); |
| 3295 |
| 3296 WasmFunctionCompiler t(sig); |
| 3297 t.env.module = &module; |
| 3298 |
| 3299 std::vector<byte> code; |
| 3300 ADD_CODE(code, kExprCallIndirect, 1); |
| 3301 ADD_CODE(code, kExprI8Const, 0); |
| 3302 for (byte p = 0; p < num_params; p++) { |
| 3303 ADD_CODE(code, kExprGetLocal, p); |
| 3304 } |
| 3305 |
| 3306 t.Build(&code[0], &code[0] + code.size()); |
| 3307 t.Compile(&module); |
| 3308 } |
| 3309 } |
| 3310 |
| 3311 |
| 3312 TEST(Compile_Wasm_CallIndirect_Many_i32) { CompileCallIndirectMany(kAstI32); } |
| 3313 |
| 3314 |
| 3315 #if WASM_64 |
| 3316 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
| 3317 #endif |
| 3318 |
| 3319 |
| 3320 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
| 3321 |
| 3322 |
| 3323 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |