summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-external-refs.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-07-25 19:30:07 +0200
committerMichaël Zasso <targos@protonmail.com>2018-07-26 08:31:50 +0200
commit6a31d05340b22fc413ee83eaacd0a5565bbbe799 (patch)
tree78f9e1c2f417244842f6422f17e1816e70317100 /deps/v8/src/wasm/wasm-external-refs.cc
parent4d94bb2b1f72b6b612983a517a39c5545724a3ad (diff)
downloadandroid-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.tar.gz
android-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.tar.bz2
android-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.zip
deps: update V8 to 6.8.275.24
PR-URL: https://github.com/nodejs/node/pull/21079 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org>
Diffstat (limited to 'deps/v8/src/wasm/wasm-external-refs.cc')
-rw-r--r--deps/v8/src/wasm/wasm-external-refs.cc197
1 files changed, 106 insertions, 91 deletions
diff --git a/deps/v8/src/wasm/wasm-external-refs.cc b/deps/v8/src/wasm/wasm-external-refs.cc
index 0a9d1401e3..0f63c35bec 100644
--- a/deps/v8/src/wasm/wasm-external-refs.cc
+++ b/deps/v8/src/wasm/wasm-external-refs.cc
@@ -18,35 +18,48 @@ namespace v8 {
namespace internal {
namespace wasm {
-void f32_trunc_wrapper(float* param) { *param = truncf(*param); }
+void f32_trunc_wrapper(Address data) {
+ WriteUnalignedValue<float>(data, truncf(ReadUnalignedValue<float>(data)));
+}
-void f32_floor_wrapper(float* param) { *param = floorf(*param); }
+void f32_floor_wrapper(Address data) {
+ WriteUnalignedValue<float>(data, floorf(ReadUnalignedValue<float>(data)));
+}
-void f32_ceil_wrapper(float* param) { *param = ceilf(*param); }
+void f32_ceil_wrapper(Address data) {
+ WriteUnalignedValue<float>(data, ceilf(ReadUnalignedValue<float>(data)));
+}
-void f32_nearest_int_wrapper(float* param) { *param = nearbyintf(*param); }
+void f32_nearest_int_wrapper(Address data) {
+ WriteUnalignedValue<float>(data, nearbyintf(ReadUnalignedValue<float>(data)));
+}
-void f64_trunc_wrapper(double* param) {
- WriteDoubleValue(param, trunc(ReadDoubleValue(param)));
+void f64_trunc_wrapper(Address data) {
+ WriteUnalignedValue<double>(data, trunc(ReadUnalignedValue<double>(data)));
}
-void f64_floor_wrapper(double* param) {
- WriteDoubleValue(param, floor(ReadDoubleValue(param)));
+void f64_floor_wrapper(Address data) {
+ WriteUnalignedValue<double>(data, floor(ReadUnalignedValue<double>(data)));
}
-void f64_ceil_wrapper(double* param) {
- WriteDoubleValue(param, ceil(ReadDoubleValue(param)));
+void f64_ceil_wrapper(Address data) {
+ WriteUnalignedValue<double>(data, ceil(ReadUnalignedValue<double>(data)));
}
-void f64_nearest_int_wrapper(double* param) {
- WriteDoubleValue(param, nearbyint(ReadDoubleValue(param)));
+void f64_nearest_int_wrapper(Address data) {
+ WriteUnalignedValue<double>(data,
+ nearbyint(ReadUnalignedValue<double>(data)));
}
-void int64_to_float32_wrapper(int64_t* input, float* output) {
- *output = static_cast<float>(ReadUnalignedValue<int64_t>(input));
+void int64_to_float32_wrapper(Address data) {
+ int64_t input = ReadUnalignedValue<int64_t>(data);
+ WriteUnalignedValue<float>(data, static_cast<float>(input));
}
-void uint64_to_float32_wrapper(uint64_t* input, float* output) {
+void uint64_to_float32_wrapper(Address data) {
+ uint64_t input = ReadUnalignedValue<uint64_t>(data);
+ float result = static_cast<float>(input);
+
#if V8_CC_MSVC
// With MSVC we use static_cast<float>(uint32_t) instead of
// static_cast<float>(uint64_t) to achieve round-to-nearest-ties-even
@@ -55,8 +68,8 @@ void uint64_to_float32_wrapper(uint64_t* input, float* output) {
// achieve proper rounding in all cases we have to adjust the high_word
// with a "rounding bit" sometimes. The rounding bit is stored in the LSB of
// the high_word if the low_word may affect the rounding of the high_word.
- uint32_t low_word = static_cast<uint32_t>(*input & 0xFFFFFFFF);
- uint32_t high_word = static_cast<uint32_t>(*input >> 32);
+ uint32_t low_word = static_cast<uint32_t>(input & 0xFFFFFFFF);
+ uint32_t high_word = static_cast<uint32_t>(input >> 32);
float shift = static_cast<float>(1ull << 32);
// If the MSB of the high_word is set, then we make space for a rounding bit.
@@ -70,166 +83,168 @@ void uint64_to_float32_wrapper(uint64_t* input, float* output) {
high_word |= 1;
}
- float result = static_cast<float>(high_word);
+ result = static_cast<float>(high_word);
result *= shift;
result += static_cast<float>(low_word);
- *output = result;
-
-#else
- *output = static_cast<float>(ReadUnalignedValue<uint64_t>(input));
#endif
+
+ WriteUnalignedValue<float>(data, result);
}
-void int64_to_float64_wrapper(int64_t* input, double* output) {
- WriteDoubleValue(output,
- static_cast<double>(ReadUnalignedValue<int64_t>(input)));
+void int64_to_float64_wrapper(Address data) {
+ int64_t input = ReadUnalignedValue<int64_t>(data);
+ WriteUnalignedValue<double>(data, static_cast<double>(input));
}
-void uint64_to_float64_wrapper(uint64_t* input, double* output) {
+void uint64_to_float64_wrapper(Address data) {
+ uint64_t input = ReadUnalignedValue<uint64_t>(data);
+ double result = static_cast<double>(input);
+
#if V8_CC_MSVC
// With MSVC we use static_cast<double>(uint32_t) instead of
// static_cast<double>(uint64_t) to achieve round-to-nearest-ties-even
// semantics. The idea is to calculate
// static_cast<double>(high_word) * 2^32 + static_cast<double>(low_word).
- uint32_t low_word = static_cast<uint32_t>(*input & 0xFFFFFFFF);
- uint32_t high_word = static_cast<uint32_t>(*input >> 32);
+ uint32_t low_word = static_cast<uint32_t>(input & 0xFFFFFFFF);
+ uint32_t high_word = static_cast<uint32_t>(input >> 32);
double shift = static_cast<double>(1ull << 32);
- double result = static_cast<double>(high_word);
+ result = static_cast<double>(high_word);
result *= shift;
result += static_cast<double>(low_word);
- *output = result;
-
-#else
- WriteDoubleValue(output,
- static_cast<double>(ReadUnalignedValue<uint64_t>(input)));
#endif
+
+ WriteUnalignedValue<double>(data, result);
}
-int32_t float32_to_int64_wrapper(float* input, int64_t* output) {
+int32_t float32_to_int64_wrapper(Address data) {
// We use "<" here to check the upper bound because of rounding problems: With
// "<=" some inputs would be considered within int64 range which are actually
// not within int64 range.
- if (*input >= static_cast<float>(std::numeric_limits<int64_t>::min()) &&
- *input < static_cast<float>(std::numeric_limits<int64_t>::max())) {
- WriteUnalignedValue<int64_t>(output, static_cast<int64_t>(*input));
+ float input = ReadUnalignedValue<float>(data);
+ if (input >= static_cast<float>(std::numeric_limits<int64_t>::min()) &&
+ input < static_cast<float>(std::numeric_limits<int64_t>::max())) {
+ WriteUnalignedValue<int64_t>(data, static_cast<int64_t>(input));
return 1;
}
return 0;
}
-int32_t float32_to_uint64_wrapper(float* input, uint64_t* output) {
+int32_t float32_to_uint64_wrapper(Address data) {
+ float input = ReadUnalignedValue<float>(data);
// We use "<" here to check the upper bound because of rounding problems: With
// "<=" some inputs would be considered within uint64 range which are actually
// not within uint64 range.
- if (*input > -1.0 &&
- *input < static_cast<float>(std::numeric_limits<uint64_t>::max())) {
- WriteUnalignedValue<uint64_t>(output, static_cast<uint64_t>(*input));
+ if (input > -1.0 &&
+ input < static_cast<float>(std::numeric_limits<uint64_t>::max())) {
+ WriteUnalignedValue<uint64_t>(data, static_cast<uint64_t>(input));
return 1;
}
return 0;
}
-int32_t float64_to_int64_wrapper(double* input, int64_t* output) {
+int32_t float64_to_int64_wrapper(Address data) {
// We use "<" here to check the upper bound because of rounding problems: With
// "<=" some inputs would be considered within int64 range which are actually
// not within int64 range.
- double input_val = ReadDoubleValue(input);
- if (input_val >= static_cast<double>(std::numeric_limits<int64_t>::min()) &&
- input_val < static_cast<double>(std::numeric_limits<int64_t>::max())) {
- WriteUnalignedValue<int64_t>(output, static_cast<int64_t>(input_val));
+ double input = ReadUnalignedValue<double>(data);
+ if (input >= static_cast<double>(std::numeric_limits<int64_t>::min()) &&
+ input < static_cast<double>(std::numeric_limits<int64_t>::max())) {
+ WriteUnalignedValue<int64_t>(data, static_cast<int64_t>(input));
return 1;
}
return 0;
}
-int32_t float64_to_uint64_wrapper(double* input, uint64_t* output) {
+int32_t float64_to_uint64_wrapper(Address data) {
// We use "<" here to check the upper bound because of rounding problems: With
// "<=" some inputs would be considered within uint64 range which are actually
// not within uint64 range.
- double input_val = ReadDoubleValue(input);
- if (input_val > -1.0 &&
- input_val < static_cast<double>(std::numeric_limits<uint64_t>::max())) {
- WriteUnalignedValue<uint64_t>(output, static_cast<uint64_t>(input_val));
+ double input = ReadUnalignedValue<double>(data);
+ if (input > -1.0 &&
+ input < static_cast<double>(std::numeric_limits<uint64_t>::max())) {
+ WriteUnalignedValue<uint64_t>(data, static_cast<uint64_t>(input));
return 1;
}
return 0;
}
-int32_t int64_div_wrapper(int64_t* dst, int64_t* src) {
- int64_t src_val = ReadUnalignedValue<int64_t>(src);
- int64_t dst_val = ReadUnalignedValue<int64_t>(dst);
- if (src_val == 0) {
+int32_t int64_div_wrapper(Address data) {
+ int64_t dividend = ReadUnalignedValue<int64_t>(data);
+ int64_t divisor = ReadUnalignedValue<int64_t>(data + sizeof(dividend));
+ if (divisor == 0) {
return 0;
}
- if (src_val == -1 && dst_val == std::numeric_limits<int64_t>::min()) {
+ if (divisor == -1 && dividend == std::numeric_limits<int64_t>::min()) {
return -1;
}
- WriteUnalignedValue<int64_t>(dst, dst_val / src_val);
+ WriteUnalignedValue<int64_t>(data, dividend / divisor);
return 1;
}
-int32_t int64_mod_wrapper(int64_t* dst, int64_t* src) {
- int64_t src_val = ReadUnalignedValue<int64_t>(src);
- int64_t dst_val = ReadUnalignedValue<int64_t>(dst);
- if (src_val == 0) {
+int32_t int64_mod_wrapper(Address data) {
+ int64_t dividend = ReadUnalignedValue<int64_t>(data);
+ int64_t divisor = ReadUnalignedValue<int64_t>(data + sizeof(dividend));
+ if (divisor == 0) {
return 0;
}
- WriteUnalignedValue<int64_t>(dst, dst_val % src_val);
+ WriteUnalignedValue<int64_t>(data, dividend % divisor);
return 1;
}
-int32_t uint64_div_wrapper(uint64_t* dst, uint64_t* src) {
- uint64_t src_val = ReadUnalignedValue<uint64_t>(src);
- uint64_t dst_val = ReadUnalignedValue<uint64_t>(dst);
- if (src_val == 0) {
+int32_t uint64_div_wrapper(Address data) {
+ uint64_t dividend = ReadUnalignedValue<uint64_t>(data);
+ uint64_t divisor = ReadUnalignedValue<uint64_t>(data + sizeof(dividend));
+ if (divisor == 0) {
return 0;
}
- WriteUnalignedValue<uint64_t>(dst, dst_val / src_val);
+ WriteUnalignedValue<uint64_t>(data, dividend / divisor);
return 1;
}
-int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) {
- uint64_t src_val = ReadUnalignedValue<uint64_t>(src);
- uint64_t dst_val = ReadUnalignedValue<uint64_t>(dst);
- if (src_val == 0) {
+int32_t uint64_mod_wrapper(Address data) {
+ uint64_t dividend = ReadUnalignedValue<uint64_t>(data);
+ uint64_t divisor = ReadUnalignedValue<uint64_t>(data + sizeof(dividend));
+ if (divisor == 0) {
return 0;
}
- WriteUnalignedValue<uint64_t>(dst, dst_val % src_val);
+ WriteUnalignedValue<uint64_t>(data, dividend % divisor);
return 1;
}
-uint32_t word32_ctz_wrapper(uint32_t* input) {
- return base::bits::CountTrailingZeros(*input);
+uint32_t word32_ctz_wrapper(Address data) {
+ return base::bits::CountTrailingZeros(ReadUnalignedValue<uint32_t>(data));
}
-uint32_t word64_ctz_wrapper(uint64_t* input) {
- return base::bits::CountTrailingZeros(ReadUnalignedValue<uint64_t>(input));
+uint32_t word64_ctz_wrapper(Address data) {
+ return base::bits::CountTrailingZeros(ReadUnalignedValue<uint64_t>(data));
}
-uint32_t word32_popcnt_wrapper(uint32_t* input) {
- return base::bits::CountPopulation(*input);
+uint32_t word32_popcnt_wrapper(Address data) {
+ return base::bits::CountPopulation(ReadUnalignedValue<uint32_t>(data));
}
-uint32_t word64_popcnt_wrapper(uint64_t* input) {
- return base::bits::CountPopulation(ReadUnalignedValue<uint64_t>(input));
+uint32_t word64_popcnt_wrapper(Address data) {
+ return base::bits::CountPopulation(ReadUnalignedValue<uint64_t>(data));
}
-uint32_t word32_rol_wrapper(uint32_t* input_p, uint32_t* shift_p) {
- uint32_t shift = (*shift_p & 31);
- return (*input_p << shift) | (*input_p >> (32 - shift));
+uint32_t word32_rol_wrapper(Address data) {
+ uint32_t input = ReadUnalignedValue<uint32_t>(data);
+ uint32_t shift = ReadUnalignedValue<uint32_t>(data + sizeof(input)) & 31;
+ return (input << shift) | (input >> (32 - shift));
}
-uint32_t word32_ror_wrapper(uint32_t* input_p, uint32_t* shift_p) {
- uint32_t shift = (*shift_p & 31);
- return (*input_p >> shift) | (*input_p << (32 - shift));
+uint32_t word32_ror_wrapper(Address data) {
+ uint32_t input = ReadUnalignedValue<uint32_t>(data);
+ uint32_t shift = ReadUnalignedValue<uint32_t>(data + sizeof(input)) & 31;
+ return (input >> shift) | (input << (32 - shift));
}
-void float64_pow_wrapper(double* param0, double* param1) {
- double x = ReadDoubleValue(param0);
- double y = ReadDoubleValue(param1);
- WriteDoubleValue(param0, Pow(x, y));
+void float64_pow_wrapper(Address data) {
+ double x = ReadUnalignedValue<double>(data);
+ double y = ReadUnalignedValue<double>(data + sizeof(x));
+ WriteUnalignedValue<double>(data, Pow(x, y));
}
void set_thread_in_wasm_flag() { trap_handler::SetThreadInWasm(); }