/* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JSVM_UTIL_H #define JSVM_UTIL_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // jsvm header #include "jsvm_dfx.h" #include "jsvm_log.h" #include "jsvm_version.h" #include "platform/platform.h" // v8 header #include "v8-inspector.h" #include "v8-platform.h" #include "v8-profiler.h" #include "v8.h" #ifdef __GNUC__ #define FORCE_INLINE __attribute__((always_inline)) #else #define FORCE_INLINE #endif namespace jsvm { template constexpr size_t ArraySize(const T (&)[N]) { return N; } } // namespace jsvm namespace v8impl { template using Persistent = v8::Global; } // namespace v8impl enum ByteSize : uint8_t { SIZE_0_BYTES = 0, SIZE_1_BYTES = 1, SIZE_2_BYTES = 2, SIZE_4_BYTES = 4, SIZE_8_BYTES = 8, }; #endif