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 <math.h> | 5 #include <math.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "include/v8config.h" | 10 #include "include/v8config.h" |
11 | 11 |
| 12 #include "src/base/bits.h" |
12 #include "src/wasm/wasm-external-refs.h" | 13 #include "src/wasm/wasm-external-refs.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 namespace wasm { | 17 namespace wasm { |
17 | 18 |
18 void f32_trunc_wrapper(float* param) { *param = truncf(*param); } | 19 void f32_trunc_wrapper(float* param) { *param = truncf(*param); } |
19 | 20 |
20 void f32_floor_wrapper(float* param) { *param = floorf(*param); } | 21 void f32_floor_wrapper(float* param) { *param = floorf(*param); } |
21 | 22 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return 1; | 170 return 1; |
170 } | 171 } |
171 | 172 |
172 int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) { | 173 int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) { |
173 if (*src == 0) { | 174 if (*src == 0) { |
174 return 0; | 175 return 0; |
175 } | 176 } |
176 *dst %= *src; | 177 *dst %= *src; |
177 return 1; | 178 return 1; |
178 } | 179 } |
| 180 |
| 181 uint32_t word32_ctz_wrapper(uint32_t* input) { |
| 182 return static_cast<uint32_t>(base::bits::CountTrailingZeros32(*input)); |
| 183 } |
| 184 |
| 185 uint32_t word64_ctz_wrapper(uint64_t* input) { |
| 186 return static_cast<uint32_t>(base::bits::CountTrailingZeros64(*input)); |
| 187 } |
| 188 |
| 189 uint32_t word32_popcnt_wrapper(uint32_t* input) { |
| 190 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); |
| 191 } |
| 192 |
| 193 uint32_t word64_popcnt_wrapper(uint64_t* input) { |
| 194 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); |
| 195 } |
| 196 |
179 } // namespace wasm | 197 } // namespace wasm |
180 } // namespace internal | 198 } // namespace internal |
181 } // namespace v8 | 199 } // namespace v8 |
OLD | NEW |