Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/wasm/wasm-external-refs.cc

Issue 2177863002: Fix failure in mjsunit/wasm/embenchen/box2d on 32-bit architectures that do not support unaligned a… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/utils.h"
14 #include "src/wasm/wasm-external-refs.h" 14 #include "src/wasm/wasm-external-refs.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 namespace wasm { 18 namespace wasm {
19 19
20 void f32_trunc_wrapper(float* param) { *param = truncf(*param); } 20 void f32_trunc_wrapper(float* param) { *param = truncf(*param); }
21 21
22 void f32_floor_wrapper(float* param) { *param = floorf(*param); } 22 void f32_floor_wrapper(float* param) { *param = floorf(*param); }
23 23
24 void f32_ceil_wrapper(float* param) { *param = ceilf(*param); } 24 void f32_ceil_wrapper(float* param) { *param = ceilf(*param); }
25 25
26 void f32_nearest_int_wrapper(float* param) { *param = nearbyintf(*param); } 26 void f32_nearest_int_wrapper(float* param) { *param = nearbyintf(*param); }
27 27
28 void f64_trunc_wrapper(double* param) { *param = trunc(*param); } 28 void f64_trunc_wrapper(double* param) {
29 WriteDoubleValue(param, trunc(ReadDoubleValue(param)));
30 }
29 31
30 void f64_floor_wrapper(double* param) { *param = floor(*param); } 32 void f64_floor_wrapper(double* param) {
33 WriteDoubleValue(param, floor(ReadDoubleValue(param)));
34 }
31 35
32 void f64_ceil_wrapper(double* param) { *param = ceil(*param); } 36 void f64_ceil_wrapper(double* param) {
37 WriteDoubleValue(param, ceil(ReadDoubleValue(param)));
38 }
33 39
34 void f64_nearest_int_wrapper(double* param) { *param = nearbyint(*param); } 40 void f64_nearest_int_wrapper(double* param) {
41 WriteDoubleValue(param, nearbyint(ReadDoubleValue(param)));
42 }
35 43
36 void int64_to_float32_wrapper(int64_t* input, float* output) { 44 void int64_to_float32_wrapper(int64_t* input, float* output) {
37 *output = static_cast<float>(*input); 45 *output = static_cast<float>(*input);
38 } 46 }
39 47
40 void uint64_to_float32_wrapper(uint64_t* input, float* output) { 48 void uint64_to_float32_wrapper(uint64_t* input, float* output) {
41 #if V8_CC_MSVC 49 #if V8_CC_MSVC
42 // With MSVC we use static_cast<float>(uint32_t) instead of 50 // With MSVC we use static_cast<float>(uint32_t) instead of
43 // static_cast<float>(uint64_t) to achieve round-to-nearest-ties-even 51 // static_cast<float>(uint64_t) to achieve round-to-nearest-ties-even
44 // semantics. The idea is to calculate 52 // semantics. The idea is to calculate
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 double x = ReadDoubleValue(param0); 207 double x = ReadDoubleValue(param0);
200 double y = ReadDoubleValue(param1); 208 double y = ReadDoubleValue(param1);
201 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { 209 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) {
202 WriteDoubleValue(param0, std::numeric_limits<double>::quiet_NaN()); 210 WriteDoubleValue(param0, std::numeric_limits<double>::quiet_NaN());
203 } 211 }
204 WriteDoubleValue(param0, Pow(x, y)); 212 WriteDoubleValue(param0, Pow(x, y));
205 } 213 }
206 } // namespace wasm 214 } // namespace wasm
207 } // namespace internal 215 } // namespace internal
208 } // namespace v8 216 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698