| Index: src/assembler.cc
|
| diff --git a/src/assembler.cc b/src/assembler.cc
|
| index 5c8c2ce16d97cf646fd774a4b8c1bcc960c75702..28f3223d5202a539bbd418028a999cd1d691cc7b 100644
|
| --- a/src/assembler.cc
|
| +++ b/src/assembler.cc
|
| @@ -1147,66 +1147,124 @@ ExternalReference ExternalReference::compute_output_frames_function(
|
| Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
|
| }
|
|
|
| -static void f32_trunc_wrapper(float* param) { *param = truncf(*param); }
|
| +static void wasm_f32_trunc_wrapper(float* param) { *param = truncf(*param); }
|
|
|
| -ExternalReference ExternalReference::f32_trunc_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_trunc_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f32_trunc(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f32_trunc_wrapper)));
|
| }
|
|
|
| -static void f32_floor_wrapper(float* param) { *param = floorf(*param); }
|
| +static void wasm_f32_floor_wrapper(float* param) { *param = floorf(*param); }
|
|
|
| -ExternalReference ExternalReference::f32_floor_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_floor_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f32_floor(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f32_floor_wrapper)));
|
| }
|
|
|
| -static void f32_ceil_wrapper(float* param) { *param = ceilf(*param); }
|
| +static void wasm_f32_ceil_wrapper(float* param) { *param = ceilf(*param); }
|
|
|
| -ExternalReference ExternalReference::f32_ceil_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f32_ceil_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f32_ceil(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f32_ceil_wrapper)));
|
| }
|
|
|
| -static void f32_nearest_int_wrapper(float* param) {
|
| +static void wasm_f32_nearest_int_wrapper(float* param) {
|
| *param = nearbyintf(*param);
|
| }
|
|
|
| -ExternalReference ExternalReference::f32_nearest_int_wrapper_function(
|
| - Isolate* isolate) {
|
| +ExternalReference ExternalReference::wasm_f32_nearest_int(Isolate* isolate) {
|
| return ExternalReference(
|
| - Redirect(isolate, FUNCTION_ADDR(f32_nearest_int_wrapper)));
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f32_nearest_int_wrapper)));
|
| }
|
|
|
| -static void f64_trunc_wrapper(double* param) { *param = trunc(*param); }
|
| +static void wasm_f64_trunc_wrapper(double* param) { *param = trunc(*param); }
|
|
|
| -ExternalReference ExternalReference::f64_trunc_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_trunc_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f64_trunc(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f64_trunc_wrapper)));
|
| }
|
|
|
| -static void f64_floor_wrapper(double* param) { *param = floor(*param); }
|
| +static void wasm_f64_floor_wrapper(double* param) { *param = floor(*param); }
|
|
|
| -ExternalReference ExternalReference::f64_floor_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_floor_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f64_floor(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f64_floor_wrapper)));
|
| }
|
|
|
| -static void f64_ceil_wrapper(double* param) { *param = ceil(*param); }
|
| +static void wasm_f64_ceil_wrapper(double* param) { *param = ceil(*param); }
|
|
|
| -ExternalReference ExternalReference::f64_ceil_wrapper_function(
|
| - Isolate* isolate) {
|
| - return ExternalReference(Redirect(isolate, FUNCTION_ADDR(f64_ceil_wrapper)));
|
| +ExternalReference ExternalReference::wasm_f64_ceil(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f64_ceil_wrapper)));
|
| }
|
|
|
| -static void f64_nearest_int_wrapper(double* param) {
|
| +static void wasm_f64_nearest_int_wrapper(double* param) {
|
| *param = nearbyint(*param);
|
| }
|
|
|
| -ExternalReference ExternalReference::f64_nearest_int_wrapper_function(
|
| - Isolate* isolate) {
|
| +ExternalReference ExternalReference::wasm_f64_nearest_int(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_f64_nearest_int_wrapper)));
|
| +}
|
| +
|
| +static void wasm_int64_to_float32_wrapper(int64_t* input, float* output) {
|
| + *output = static_cast<float>(*input);
|
| +}
|
| +
|
| +ExternalReference ExternalReference::wasm_int64_to_float32(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_int64_to_float32_wrapper)));
|
| +}
|
| +
|
| +static void wasm_uint64_to_float32_wrapper(uint64_t* input, float* output) {
|
| + uint64_t value = *input;
|
| +#if V8_CC_MSVC
|
| + // static_cast<float>(uint64_t input) is not defined in the C standard if the
|
| + // input value cannot be represented exactly as double. The clang and gcc
|
| + // implementations satisfy the IEEE 754-2008 standard. msvc violates the
|
| + // standard in some cases where the MSB and the LSB of the input is set.
|
| + // With the additional calculation below the standard is also satisfied with
|
| + // msvc in all cases.
|
| + if ((value & 0x8000000000000000) != 0) {
|
| + value |= ((value & 1) << 1);
|
| + }
|
| +#endif
|
| + *output = static_cast<float>(value);
|
| +}
|
| +
|
| +ExternalReference ExternalReference::wasm_uint64_to_float32(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_uint64_to_float32_wrapper)));
|
| +}
|
| +
|
| +static void wasm_int64_to_float64_wrapper(int64_t* input, double* output) {
|
| + *output = static_cast<double>(*input);
|
| +}
|
| +
|
| +ExternalReference ExternalReference::wasm_int64_to_float64(Isolate* isolate) {
|
| + return ExternalReference(
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_int64_to_float64_wrapper)));
|
| +}
|
| +
|
| +static void wasm_uint64_to_float64_wrapper(uint64_t* input, double* output) {
|
| + uint64_t value = *input;
|
| +#if V8_CC_MSVC
|
| + // static_cast<double>(uint64_t input) is not defined in the C standard if the
|
| + // input value cannot be represented exactly as double. The clang and gcc
|
| + // implementations satisfy the IEEE 754-2008 standard. msvc violates the
|
| + // standard in some cases where the MSB and the LSB of the input is set.
|
| + // With the additional calculation below the standard is also satisfied with
|
| + // msvc in all cases.
|
| + if ((value & 0x8000000000000000) != 0) {
|
| + value |= ((value & 1) << 1);
|
| + }
|
| +#endif
|
| + *output = static_cast<double>(value);
|
| +}
|
| +
|
| +ExternalReference ExternalReference::wasm_uint64_to_float64(Isolate* isolate) {
|
| return ExternalReference(
|
| - Redirect(isolate, FUNCTION_ADDR(f64_nearest_int_wrapper)));
|
| + Redirect(isolate, FUNCTION_ADDR(wasm_uint64_to_float64_wrapper)));
|
| }
|
|
|
| ExternalReference ExternalReference::log_enter_external_function(
|
|
|