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/base/bits.h" |
| 13 #include "src/utils.h" |
13 #include "src/wasm/wasm-external-refs.h" | 14 #include "src/wasm/wasm-external-refs.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 namespace wasm { | 18 namespace wasm { |
18 | 19 |
19 void f32_trunc_wrapper(float* param) { *param = truncf(*param); } | 20 void f32_trunc_wrapper(float* param) { *param = truncf(*param); } |
20 | 21 |
21 void f32_floor_wrapper(float* param) { *param = floorf(*param); } | 22 void f32_floor_wrapper(float* param) { *param = floorf(*param); } |
22 | 23 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 188 } |
188 | 189 |
189 uint32_t word32_popcnt_wrapper(uint32_t* input) { | 190 uint32_t word32_popcnt_wrapper(uint32_t* input) { |
190 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); | 191 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); |
191 } | 192 } |
192 | 193 |
193 uint32_t word64_popcnt_wrapper(uint64_t* input) { | 194 uint32_t word64_popcnt_wrapper(uint64_t* input) { |
194 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); | 195 return static_cast<uint32_t>(base::bits::CountPopulation(*input)); |
195 } | 196 } |
196 | 197 |
| 198 void float64_pow_wrapper(double* param0, double* param1) { |
| 199 double x = ReadDoubleValue(param0); |
| 200 double y = ReadDoubleValue(param1); |
| 201 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { |
| 202 WriteDoubleValue(param0, std::numeric_limits<double>::quiet_NaN()); |
| 203 } |
| 204 WriteDoubleValue(param0, Pow(x, y)); |
| 205 } |
197 } // namespace wasm | 206 } // namespace wasm |
198 } // namespace internal | 207 } // namespace internal |
199 } // namespace v8 | 208 } // namespace v8 |
OLD | NEW |