Index: src/wasm/wasm-external-refs.h |
diff --git a/src/wasm/wasm-external-refs.h b/src/wasm/wasm-external-refs.h |
index 1004f50e4c2b8e7b89257d2505ad74fbb9081df5..4aa452bbf58b1647a500e38d022993580ae688a5 100644 |
--- a/src/wasm/wasm-external-refs.h |
+++ b/src/wasm/wasm-external-refs.h |
@@ -139,6 +139,41 @@ static int32_t float64_to_uint64_wrapper(double* input, uint64_t* output) { |
} |
return 0; |
} |
+ |
+static int32_t int64_div_wrapper(int64_t* dst, int64_t* src) { |
+ if (*src == 0) { |
+ return 0; |
+ } |
+ if (*src == -1 && *dst == std::numeric_limits<int64_t>::min()) { |
+ return -1; |
+ } |
+ *dst /= *src; |
+ return 1; |
+} |
+ |
+static int32_t int64_mod_wrapper(int64_t* dst, int64_t* src) { |
+ if (*src == 0) { |
+ return 0; |
+ } |
+ *dst %= *src; |
+ return 1; |
+} |
+ |
+static int32_t uint64_div_wrapper(uint64_t* dst, uint64_t* src) { |
+ if (*src == 0) { |
+ return 0; |
+ } |
+ *dst /= *src; |
+ return 1; |
+} |
+ |
+static int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) { |
+ if (*src == 0) { |
+ return 0; |
+ } |
+ *dst %= *src; |
+ return 1; |
+} |
} // namespace wasm |
} // namespace internal |
} // namespace v8 |