v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
memcopy.cc
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "src/utils/memcopy.h"
6
8
9namespace v8 {
10namespace internal {
11
12#if V8_TARGET_ARCH_IA32
13static void MemMoveWrapper(void* dest, const void* src, size_t size) {
14 memmove(dest, src, size);
15}
16
17// Initialize to library version so we can call this at any time during startup.
18static MemMoveFunction memmove_function = &MemMoveWrapper;
19
20// Copy memory area to disjoint memory area.
22V8_EXPORT_PRIVATE void MemMove(void* dest, const void* src, size_t size) {
23 if (size == 0) return;
24 // Note: here we rely on dependent reads being ordered. This is true
25 // on all architectures we currently support.
26 (*memmove_function)(dest, src, size);
27}
28#elif(V8_OS_POSIX || V8_OS_STARBOARD) && V8_HOST_ARCH_ARM
29V8_EXPORT_PRIVATE MemCopyUint8Function memcopy_uint8_function =
30 &MemCopyUint8Wrapper;
31#elif V8_OS_POSIX && V8_HOST_ARCH_MIPS
32V8_EXPORT_PRIVATE MemCopyUint8Function memcopy_uint8_function =
33 &MemCopyUint8Wrapper;
34#endif
35
37#if V8_TARGET_ARCH_IA32
40 memmove_function = reinterpret_cast<MemMoveFunction>(
41 d.InstructionStartOf(Builtin::kMemMove));
42 }
43#elif(V8_OS_POSIX || V8_OS_STARBOARD) && V8_HOST_ARCH_ARM
46 memcopy_uint8_function = reinterpret_cast<MemCopyUint8Function>(
47 d.InstructionStartOf(Builtin::kMemCopyUint8Uint8));
48 }
49#elif V8_OS_POSIX && V8_HOST_ARCH_MIPS
52 memcopy_uint8_function = reinterpret_cast<MemCopyUint8Function>(
53 d.InstructionStartOf(Builtin::kMemCopyUint8Uint8));
54 }
55#endif
56}
57
58} // namespace internal
59} // namespace v8
static EmbeddedData FromBlob()
static bool CurrentEmbeddedBlobIsBinaryEmbedded()
Definition isolate.cc:312
V8_EXPORT_PRIVATE void MemMove(void *dest, const void *src, size_t size)
Definition memcopy.h:189
void init_memcopy_functions()
Definition memcopy.cc:36
#define DISABLE_CFI_ICALL
Definition macros.h:209
#define V8_EXPORT_PRIVATE
Definition macros.h:460