11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#if !V8_ENABLE_WEBASSEMBLY
61cb0ef41Sopenharmony_ci#error This header should only be included if WebAssembly is enabled.
71cb0ef41Sopenharmony_ci#endif  // !V8_ENABLE_WEBASSEMBLY
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci#ifndef V8_WASM_WASM_EXTERNAL_REFS_H_
101cb0ef41Sopenharmony_ci#define V8_WASM_WASM_EXTERNAL_REFS_H_
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci#include <stdint.h>
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci#include "src/common/globals.h"
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cinamespace v8 {
171cb0ef41Sopenharmony_cinamespace internal {
181cb0ef41Sopenharmony_cinamespace wasm {
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32_trunc_wrapper(Address data);
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32_floor_wrapper(Address data);
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32_ceil_wrapper(Address data);
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32_nearest_int_wrapper(Address data);
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64_trunc_wrapper(Address data);
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64_floor_wrapper(Address data);
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64_ceil_wrapper(Address data);
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64_nearest_int_wrapper(Address data);
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void int64_to_float32_wrapper(Address data);
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void uint64_to_float32_wrapper(Address data);
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void int64_to_float64_wrapper(Address data);
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void uint64_to_float64_wrapper(Address data);
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t float32_to_int64_wrapper(Address data);
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t float32_to_uint64_wrapper(Address data);
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t float64_to_int64_wrapper(Address data);
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t float64_to_uint64_wrapper(Address data);
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void float32_to_int64_sat_wrapper(Address data);
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void float32_to_uint64_sat_wrapper(Address data);
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void float64_to_int64_sat_wrapper(Address data);
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void float64_to_uint64_sat_wrapper(Address data);
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t int64_div_wrapper(Address data);
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t int64_mod_wrapper(Address data);
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t uint64_div_wrapper(Address data);
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE int32_t uint64_mod_wrapper(Address data);
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word32_ctz_wrapper(Address data);
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word64_ctz_wrapper(Address data);
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word32_popcnt_wrapper(Address data);
731cb0ef41Sopenharmony_ci
741cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word64_popcnt_wrapper(Address data);
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word32_rol_wrapper(Address data);
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE uint32_t word32_ror_wrapper(Address data);
791cb0ef41Sopenharmony_ci
801cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void word64_rol_wrapper(Address data);
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void word64_ror_wrapper(Address data);
831cb0ef41Sopenharmony_ci
841cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void float64_pow_wrapper(Address data);
851cb0ef41Sopenharmony_ci
861cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64x2_ceil_wrapper(Address data);
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64x2_floor_wrapper(Address data);
891cb0ef41Sopenharmony_ci
901cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64x2_trunc_wrapper(Address data);
911cb0ef41Sopenharmony_ci
921cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f64x2_nearest_int_wrapper(Address data);
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32x4_ceil_wrapper(Address data);
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32x4_floor_wrapper(Address data);
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32x4_trunc_wrapper(Address data);
991cb0ef41Sopenharmony_ci
1001cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void f32x4_nearest_int_wrapper(Address data);
1011cb0ef41Sopenharmony_ci
1021cb0ef41Sopenharmony_ci// The return type is {int32_t} instead of {bool} to enforce the compiler to
1031cb0ef41Sopenharmony_ci// zero-extend the result in the return register.
1041cb0ef41Sopenharmony_ciint32_t memory_init_wrapper(Address data);
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci// The return type is {int32_t} instead of {bool} to enforce the compiler to
1071cb0ef41Sopenharmony_ci// zero-extend the result in the return register.
1081cb0ef41Sopenharmony_ciint32_t memory_copy_wrapper(Address data);
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci// The return type is {int32_t} instead of {bool} to enforce the compiler to
1111cb0ef41Sopenharmony_ci// zero-extend the result in the return register.
1121cb0ef41Sopenharmony_ciint32_t memory_fill_wrapper(Address data);
1131cb0ef41Sopenharmony_ci
1141cb0ef41Sopenharmony_ci// Assumes copy ranges are in-bounds and length > 0.
1151cb0ef41Sopenharmony_civoid array_copy_wrapper(Address raw_instance, Address raw_dst_array,
1161cb0ef41Sopenharmony_ci                        uint32_t dst_index, Address raw_src_array,
1171cb0ef41Sopenharmony_ci                        uint32_t src_index, uint32_t length);
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ciusing WasmTrapCallbackForTesting = void (*)();
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void set_trap_callback_for_testing(
1221cb0ef41Sopenharmony_ci    WasmTrapCallbackForTesting callback);
1231cb0ef41Sopenharmony_ci
1241cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void call_trap_callback_for_testing();
1251cb0ef41Sopenharmony_ci
1261cb0ef41Sopenharmony_ci}  // namespace wasm
1271cb0ef41Sopenharmony_ci}  // namespace internal
1281cb0ef41Sopenharmony_ci}  // namespace v8
1291cb0ef41Sopenharmony_ci
1301cb0ef41Sopenharmony_ci#endif  // V8_WASM_WASM_EXTERNAL_REFS_H_
131