Revert to use memcpy instead of base::Memcpy

For Cobalt's purpose in the past, we introduced base::Memcpy to
intercept memcpy calls and replace it with SbMemoryCopy on
Starboard/Cobalt. Recently Cobalt removed SbMemoryCopy because we found
out that memcpy implementation is universal. To reduce the cost to
maintain base::Memcpy, let us remove it and revert back to raw memcpy.

Bug: v8:10927
Change-Id: I060f191f8f1aed8b78ffe4558a3743f3a2da008b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2951462
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: John Xu <johnx@google.com>
Cr-Commit-Position: refs/heads/master@{#75070}
This commit is contained in:
John Xu 2021-06-10 08:18:07 +00:00 committed by V8 LUCI CQ
parent c1e9da818a
commit 0395c42b1e
82 changed files with 257 additions and 275 deletions

View File

@ -5375,7 +5375,7 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
for (int i = read_index; i < up_to; i++) char_mask |= read_start[i];
if ((char_mask & 0x80) == 0) {
int copy_length = up_to - read_index;
base::Memcpy(current_write, read_start + read_index, copy_length);
memcpy(current_write, read_start + read_index, copy_length);
current_write += copy_length;
read_index = up_to;
} else {
@ -7592,7 +7592,7 @@ void* v8::ArrayBuffer::Allocator::Reallocate(void* data, size_t old_length,
reinterpret_cast<uint8_t*>(AllocateUninitialized(new_length));
if (new_data == nullptr) return nullptr;
size_t bytes_to_copy = std::min(old_length, new_length);
base::Memcpy(new_data, data, bytes_to_copy);
memcpy(new_data, data, bytes_to_copy);
if (new_length > bytes_to_copy) {
memset(new_data + bytes_to_copy, 0, new_length - bytes_to_copy);
}
@ -7726,7 +7726,7 @@ size_t v8::ArrayBufferView::CopyContents(void* dest, size_t byte_length) {
isolate);
source = reinterpret_cast<char*>(typed_array->DataPtr());
}
base::Memcpy(dest, source + byte_offset, bytes_to_copy);
memcpy(dest, source + byte_offset, bytes_to_copy);
}
return bytes_to_copy;
}

View File

@ -404,7 +404,7 @@ const AstRawString* AstValueFactory::GetString(
// Copy literal contents for later comparison.
int length = literal_bytes.length();
byte* new_literal_bytes = zone()->NewArray<byte>(length);
base::Memcpy(new_literal_bytes, literal_bytes.begin(), length);
memcpy(new_literal_bytes, literal_bytes.begin(), length);
AstRawString* new_string = zone()->New<AstRawString>(
is_one_byte, Vector<const byte>(new_literal_bytes, length),
raw_hash_field);

View File

@ -259,7 +259,7 @@ std::unique_ptr<char[]> FunctionLiteral::GetDebugName() const {
}
}
std::unique_ptr<char[]> result(new char[result_vec.size() + 1]);
base::Memcpy(result.get(), result_vec.data(), result_vec.size());
memcpy(result.get(), result_vec.data(), result_vec.size());
result[result_vec.size()] = '\0';
return result;
}

View File

@ -316,7 +316,7 @@ class CPUInfo final {
size_t len = q - p;
char* result = new char[len + 1];
if (result != nullptr) {
base::Memcpy(result, p, len);
memcpy(result, p, len);
result[len] = '\0';
}
return result;
@ -448,7 +448,7 @@ CPU::CPU()
has_non_stop_time_stamp_counter_(false),
is_running_in_vm_(false),
has_msa_(false) {
base::Memcpy(vendor_, "Unknown", 8);
memcpy(vendor_, "Unknown", 8);
#if defined(STARBOARD)
if (StarboardDetectCPU()) {
@ -469,7 +469,7 @@ CPU::CPU()
__cpuid(cpu_info, 0);
unsigned num_ids = cpu_info[0];
std::swap(cpu_info[2], cpu_info[3]);
base::Memcpy(vendor_, cpu_info + 1, 12);
memcpy(vendor_, cpu_info + 1, 12);
vendor_[12] = '\0';
// Interpret CPU feature information.

View File

@ -22,8 +22,8 @@ std::unique_ptr<char[]> RelativePath(const char* exec_path, const char* name) {
}
size_t name_length = strlen(name);
auto buffer = std::make_unique<char[]>(basename_start + name_length + 1);
if (basename_start > 0) base::Memcpy(buffer.get(), exec_path, basename_start);
base::Memcpy(buffer.get() + basename_start, name, name_length);
if (basename_start > 0) memcpy(buffer.get(), exec_path, basename_start);
memcpy(buffer.get() + basename_start, name, name_length);
return buffer;
}

View File

@ -198,7 +198,7 @@ TemplateHashMapImpl<Key, Value, MatchFun, AllocationPolicy>::
impl_.capacity_ = original->capacity();
impl_.occupancy_ = original->occupancy();
impl_.map_ = impl_.allocator().template NewArray<Entry>(capacity());
base::Memcpy(impl_.map_, original->impl_.map_, capacity() * sizeof(Entry));
memcpy(impl_.map_, original->impl_.map_, capacity() * sizeof(Entry));
}
template <typename Key, typename Value, typename MatchFun,

View File

@ -105,7 +105,7 @@ V8_INLINE Dest bit_cast(Source const& source) {
static_assert(sizeof(Dest) == sizeof(Source),
"source and dest must be same size");
Dest dest;
v8::base::Memcpy(&dest, &source, sizeof(dest));
memcpy(&dest, &source, sizeof(dest));
return dest;
}

View File

@ -32,14 +32,14 @@ template <typename V>
static inline V ReadUnalignedValue(Address p) {
ASSERT_TRIVIALLY_COPYABLE(V);
V r;
base::Memcpy(&r, reinterpret_cast<void*>(p), sizeof(V));
memcpy(&r, reinterpret_cast<void*>(p), sizeof(V));
return r;
}
template <typename V>
static inline void WriteUnalignedValue(Address p, V value) {
ASSERT_TRIVIALLY_COPYABLE(V);
base::Memcpy(reinterpret_cast<void*>(p), &value, sizeof(V));
memcpy(reinterpret_cast<void*>(p), &value, sizeof(V));
}
template <typename V>

View File

@ -109,7 +109,7 @@ PageAllocator::AllocateSharedPages(size_t size, const void* original_address) {
void* ptr =
base::OS::AllocateShared(size, base::OS::MemoryPermission::kReadWrite);
CHECK_NOT_NULL(ptr);
base::Memcpy(ptr, original_address, size);
memcpy(ptr, original_address, size);
bool success = base::OS::SetPermissions(
ptr, size, base::OS::MemoryPermission::kReadWrite);
CHECK(success);

View File

@ -33,10 +33,6 @@ inline void Free(void* memory) { return free(memory); }
inline void* Calloc(size_t count, size_t size) { return calloc(count, size); }
inline void* Memcpy(void* dest, const void* source, size_t count) {
return memcpy(dest, source, count);
}
inline FILE* Fopen(const char* filename, const char* mode) {
return fopen(filename, mode);
}
@ -57,10 +53,6 @@ inline void* Calloc(size_t count, size_t size) {
return SbMemoryCalloc(count, size);
}
inline void* Memcpy(void* dest, const void* source, size_t count) {
return SbMemoryCopy(dest, source, count);
}
inline FILE* Fopen(const char* filename, const char* mode) { return NULL; }
inline int Fclose(FILE* stream) { return -1; }

View File

@ -34,7 +34,7 @@ class SmallVector {
SmallVector(SmallVector&& other) V8_NOEXCEPT { *this = std::move(other); }
SmallVector(std::initializer_list<T> init) {
resize_no_init(init.size());
base::Memcpy(begin_, init.begin(), sizeof(T) * init.size());
memcpy(begin_, init.begin(), sizeof(T) * init.size());
}
~SmallVector() {
@ -50,7 +50,7 @@ class SmallVector {
begin_ = reinterpret_cast<T*>(base::Malloc(sizeof(T) * other_size));
end_of_storage_ = begin_ + other_size;
}
base::Memcpy(begin_, other.begin_, sizeof(T) * other_size);
memcpy(begin_, other.begin_, sizeof(T) * other_size);
end_ = begin_ + other_size;
return *this;
}
@ -66,7 +66,7 @@ class SmallVector {
} else {
DCHECK_GE(capacity(), other.size()); // Sanity check.
size_t other_size = other.size();
base::Memcpy(begin_, other.begin_, sizeof(T) * other_size);
memcpy(begin_, other.begin_, sizeof(T) * other_size);
end_ = begin_ + other_size;
}
return *this;
@ -161,7 +161,7 @@ class SmallVector {
// crashes appropriately.
FATAL("Fatal process out of memory: base::SmallVector::Grow");
}
base::Memcpy(new_storage, begin_, sizeof(T) * in_use);
memcpy(new_storage, begin_, sizeof(T) * in_use);
if (is_big()) base::Free(begin_);
begin_ = new_storage;
end_ = new_storage + in_use;

View File

@ -42,8 +42,8 @@ class MaybeUtf8 {
// strings, the bytes we get from SeqOneByteString are not. buf_ is
// guaranteed to be null terminated.
DisallowGarbageCollection no_gc;
base::Memcpy(
buf_, Handle<SeqOneByteString>::cast(string)->GetChars(no_gc), len);
memcpy(buf_, Handle<SeqOneByteString>::cast(string)->GetChars(no_gc),
len);
}
} else {
Local<v8::String> local = Utils::ToLocal(string);

View File

@ -582,7 +582,7 @@ void Assembler::bind(Label* label) {
// Internal references do not get patched to an instruction but directly
// to an address.
internal_reference_positions_.push_back(linkoffset);
base::Memcpy(link, &pc_, kSystemPointerSize);
memcpy(link, &pc_, kSystemPointerSize);
} else {
link->SetImmPCOffsetTarget(options(),
reinterpret_cast<Instruction*>(pc_));

View File

@ -2616,7 +2616,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
STATIC_ASSERT(sizeof(instruction) == kInstrSize);
DCHECK_LE(pc_ + sizeof(instruction), buffer_start_ + buffer_->size());
base::Memcpy(pc_, &instruction, sizeof(instruction));
memcpy(pc_, &instruction, sizeof(instruction));
pc_ += sizeof(instruction);
CheckBuffer();
}
@ -2628,7 +2628,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// TODO(all): Somehow register we have some data here. Then we can
// disassemble it correctly.
base::Memcpy(pc_, data, size);
memcpy(pc_, data, size);
pc_ += size;
CheckBuffer();
}

View File

@ -393,7 +393,7 @@ void TurboAssembler::Movi32bitHelper(const VRegister& vd, uint64_t imm) {
DCHECK(is_uint32(imm));
uint8_t bytes[sizeof(imm)];
base::Memcpy(bytes, &imm, sizeof(imm));
memcpy(bytes, &imm, sizeof(imm));
// All bytes are either 0x00 or 0xFF.
{

View File

@ -786,7 +786,7 @@ void* libc_memchr(void* string, int character, size_t search_length) {
FUNCTION_REFERENCE(libc_memchr_function, libc_memchr)
void* libc_memcpy(void* dest, const void* src, size_t n) {
return base::Memcpy(dest, src, n);
return memcpy(dest, src, n);
}
FUNCTION_REFERENCE(libc_memcpy_function, libc_memcpy)

View File

@ -168,7 +168,7 @@ std::unique_ptr<char[]> OptimizedCompilationInfo::GetDebugName() const {
Vector<const char> name_vec = debug_name_;
if (name_vec.empty()) name_vec = ArrayVector("unknown");
std::unique_ptr<char[]> name(new char[name_vec.length() + 1]);
base::Memcpy(name.get(), name_vec.begin(), name_vec.length());
memcpy(name.get(), name_vec.begin(), name_vec.length());
name[name_vec.length()] = '\0';
return name;
}

View File

@ -2034,7 +2034,7 @@ void Assembler::Nop(int n) {
EnsureSpace ensure_space(this);
int nop_bytes = std::min(n, 9);
const char* sequence = kNopSequences + kNopOffsets[nop_bytes];
base::Memcpy(pc_, sequence, nop_bytes);
memcpy(pc_, sequence, nop_bytes);
pc_ += nop_bytes;
n -= nop_bytes;
} while (n);

View File

@ -2705,7 +2705,7 @@ void InstructionSelector::VisitI32x4DotI16x8S(Node* node) {
void InstructionSelector::VisitS128Const(Node* node) {
ArmOperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants.
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -3563,7 +3563,7 @@ void InstructionSelector::VisitS128Const(Node* node) {
static const int kUint32Immediates = 4;
uint32_t val[kUint32Immediates];
STATIC_ASSERT(sizeof(val) == kSimd128Size);
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
InstructionOperand dst = g.DefineAsRegister(node);

View File

@ -2332,7 +2332,7 @@ void InstructionSelector::VisitS128Const(Node* node) {
IA32OperandGenerator g(this);
static const int kUint32Immediates = kSimd128Size / sizeof(uint32_t);
uint32_t val[kUint32Immediates];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros or ones, avoid emitting code for generic constants
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -3366,8 +3366,7 @@ FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
void InstructionSelector::CanonicalizeShuffle(Node* node, uint8_t* shuffle,
bool* is_swizzle) {
// Get raw shuffle indices.
base::Memcpy(shuffle, S128ImmediateParameterOf(node->op()).data(),
kSimd128Size);
memcpy(shuffle, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
bool needs_swap;
bool inputs_equal = GetVirtualRegister(node->InputAt(0)) ==
GetVirtualRegister(node->InputAt(1));

View File

@ -3021,7 +3021,7 @@ void InstructionSelector::VisitS128Const(Node* node) {
Mips64OperandGenerator g(this);
static const int kUint32Immediates = kSimd128Size / sizeof(uint32_t);
uint32_t val[kUint32Immediates];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros or ones, avoid emitting code for generic constants
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -2507,7 +2507,7 @@ static int32_t Pack4Lanes(const uint8_t* shuffle) {
void InstructionSelector::VisitS128Const(Node* node) {
PPCOperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants.
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -2763,7 +2763,7 @@ static int32_t Pack4Lanes(const uint8_t* shuffle) {
void InstructionSelector::VisitS128Const(Node* node) {
S390OperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros, avoid emitting code for generic constants.
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -3022,7 +3022,7 @@ void InstructionSelector::VisitS128Const(Node* node) {
X64OperandGenerator g(this);
static const int kUint32Immediates = kSimd128Size / sizeof(uint32_t);
uint32_t val[kUint32Immediates];
base::Memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
memcpy(val, S128ImmediateParameterOf(node->op()).data(), kSimd128Size);
// If all bytes are zeros or ones, avoid emitting code for generic constants
bool all_zeros = !(val[0] || val[1] || val[2] || val[3]);
bool all_ones = val[0] == UINT32_MAX && val[1] == UINT32_MAX &&

View File

@ -4402,8 +4402,7 @@ Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count,
if (has_effect) ++input_count_with_deps;
Node** buffer = EnsureInputBufferSize(input_count_with_deps);
if (value_input_count > 0) {
base::Memcpy(buffer, value_inputs,
kSystemPointerSize * value_input_count);
memcpy(buffer, value_inputs, kSystemPointerSize * value_input_count);
}
Node** current_input = buffer + value_input_count;
if (has_context) {

View File

@ -257,7 +257,7 @@ std::unique_ptr<char[]> GetVisualizerLogFileName(OptimizedCompilationInfo* info,
}
char* buffer = new char[full_filename.length() + 1];
base::Memcpy(buffer, full_filename.begin(), full_filename.length());
memcpy(buffer, full_filename.begin(), full_filename.length());
buffer[full_filename.length()] = '\0';
return std::unique_ptr<char[]>(buffer);
}

View File

@ -1433,7 +1433,7 @@ Node* WasmGraphBuilder::Return(Vector<Node*> vals) {
buf[0] = Int32Constant(0);
if (count > 0) {
base::Memcpy(buf.data() + 1, vals.begin(), sizeof(void*) * count);
memcpy(buf.data() + 1, vals.begin(), sizeof(void*) * count);
}
buf[count + 1] = effect();
buf[count + 2] = control();
@ -2872,7 +2872,7 @@ Node* WasmGraphBuilder::BuildCallNode(const wasm::FunctionSig* sig,
// Make room for the instance_node parameter at index 1, just after code.
inputs[0] = args[0]; // code
inputs[1] = instance_node;
if (params > 0) base::Memcpy(&inputs[2], &args[1], params * sizeof(Node*));
if (params > 0) memcpy(&inputs[2], &args[1], params * sizeof(Node*));
// Add effect and control inputs.
if (has_frame_state != 0) inputs[params + 2] = frame_state;
@ -7669,7 +7669,7 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
constexpr size_t kMaxNameLen = 128;
constexpr size_t kNamePrefixLen = 11;
auto name_buffer = std::unique_ptr<char[]>(new char[kMaxNameLen]);
base::Memcpy(name_buffer.get(), "wasm-to-js:", kNamePrefixLen);
memcpy(name_buffer.get(), "wasm-to-js:", kNamePrefixLen);
PrintSignature(VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen,
sig);
@ -7721,7 +7721,7 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
constexpr size_t kMaxNameLen = 128;
constexpr size_t kNamePrefixLen = 9;
auto name_buffer = std::unique_ptr<char[]>(new char[kMaxNameLen]);
base::Memcpy(name_buffer.get(), "js-to-js:", kNamePrefixLen);
memcpy(name_buffer.get(), "js-to-js:", kNamePrefixLen);
PrintSignature(VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen,
sig);
@ -7776,7 +7776,7 @@ Handle<Code> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig,
constexpr size_t kMaxNameLen = 128;
constexpr size_t kNamePrefixLen = 13;
auto name_buffer = std::unique_ptr<char[]>(new char[kMaxNameLen]);
base::Memcpy(name_buffer.get(), "c-wasm-entry:", kNamePrefixLen);
memcpy(name_buffer.get(), "c-wasm-entry:", kNamePrefixLen);
PrintSignature(VectorOf(name_buffer.get(), kMaxNameLen) + kNamePrefixLen,
sig);
@ -7839,7 +7839,7 @@ Vector<const char> GetDebugName(Zone* zone, int index) {
DCHECK(name_len > 0 && name_len < name_vector.length());
char* index_name = zone->NewArray<char>(name_len);
base::Memcpy(index_name, name_vector.begin(), name_len);
memcpy(index_name, name_vector.begin(), name_len);
return Vector<const char>(index_name, name_len);
}

View File

@ -318,7 +318,7 @@ static Local<Value> GetStdout(Isolate* isolate, int child_fd,
.ToLocalChecked();
accumulator = String::Concat(isolate, accumulator, addition);
fullness = bytes_read + fullness - length;
base::Memcpy(buffer, buffer + length, fullness);
memcpy(buffer, buffer + length, fullness);
}
} while (bytes_read != 0);
return accumulator;

View File

@ -485,7 +485,7 @@ ScriptCompiler::CachedData* Shell::LookupCodeCache(Isolate* isolate,
if (entry != cached_code_map_.end() && entry->second) {
int length = entry->second->length;
uint8_t* cache = new uint8_t[length];
base::Memcpy(cache, entry->second->data, length);
memcpy(cache, entry->second->data, length);
ScriptCompiler::CachedData* cached_data = new ScriptCompiler::CachedData(
cache, length, ScriptCompiler::CachedData::BufferOwned);
return cached_data;
@ -502,7 +502,7 @@ void Shell::StoreInCodeCache(Isolate* isolate, Local<Value> source,
DCHECK(*key);
int length = cache_data->length;
uint8_t* cache = new uint8_t[length];
base::Memcpy(cache, cache_data->data, length);
memcpy(cache, cache_data->data, length);
cached_code_map_[*key] = std::unique_ptr<ScriptCompiler::CachedData>(
new ScriptCompiler::CachedData(cache, length,
ScriptCompiler::CachedData::BufferOwned));

View File

@ -119,7 +119,7 @@ Transport::~Transport() {
void Transport::CopyFromBuffer(char** dst, int32_t* len) {
int32_t copy_bytes = std::min(*len, size_ - pos_);
base::Memcpy(*dst, buf_.get() + pos_, copy_bytes);
memcpy(*dst, buf_.get() + pos_, copy_bytes);
pos_ += copy_bytes;
*len -= copy_bytes;
*dst += copy_bytes;

View File

@ -295,11 +295,11 @@ uint32_t WasmModuleDebug::GetWasmMemory(Isolate* isolate, uint32_t offset,
uint8_t* mem_start = instance->memory_start();
size_t mem_size = instance->memory_size();
if (static_cast<uint64_t>(offset) + size <= mem_size) {
base::Memcpy(buffer, mem_start + offset, size);
memcpy(buffer, mem_start + offset, size);
bytes_read = size;
} else if (offset < mem_size) {
bytes_read = static_cast<uint32_t>(mem_size) - offset;
base::Memcpy(buffer, mem_start + offset, bytes_read);
memcpy(buffer, mem_start + offset, bytes_read);
}
}
return bytes_read;
@ -347,7 +347,7 @@ uint32_t WasmModuleDebug::GetWasmModuleBytes(wasm_addr_t wasm_addr,
if (offset < wire_bytes.length()) {
uint32_t module_size = static_cast<uint32_t>(wire_bytes.length());
bytes_read = module_size - offset >= size ? size : module_size - offset;
base::Memcpy(buffer, wire_bytes.start() + offset, bytes_read);
memcpy(buffer, wire_bytes.start() + offset, bytes_read);
}
}
return bytes_read;
@ -380,7 +380,7 @@ bool StoreValue(const T& value, uint8_t* buffer, uint32_t buffer_size,
uint32_t* size) {
*size = sizeof(value);
if (*size > buffer_size) return false;
base::Memcpy(buffer, &value, *size);
memcpy(buffer, &value, *size);
return true;
}

View File

@ -629,7 +629,7 @@ class ELF {
#else
#error Unsupported target architecture.
#endif
base::Memcpy(header->ident, ident, 16);
memcpy(header->ident, ident, 16);
header->type = 1;
#if V8_TARGET_ARCH_IA32
header->machine = 3;

View File

@ -171,8 +171,8 @@ void InitUnwindingRecord(Record* record, size_t code_size_in_bytes) {
masm.movq(rax, reinterpret_cast<uint64_t>(&CRASH_HANDLER_FUNCTION_NAME));
masm.jmp(rax);
DCHECK_LE(masm.instruction_size(), sizeof(record->exception_thunk));
base::Memcpy(&record->exception_thunk[0], masm.buffer_start(),
masm.instruction_size());
memcpy(&record->exception_thunk[0], masm.buffer_start(),
masm.instruction_size());
}
#elif defined(V8_OS_WIN_ARM64)
@ -449,8 +449,8 @@ void InitUnwindingRecord(Record* record, size_t code_size_in_bytes) {
Operand(reinterpret_cast<uint64_t>(&CRASH_HANDLER_FUNCTION_NAME)));
masm.Br(x16);
DCHECK_LE(masm.instruction_size(), sizeof(record->exception_thunk));
base::Memcpy(&record->exception_thunk[0], masm.buffer_start(),
masm.instruction_size());
memcpy(&record->exception_thunk[0], masm.buffer_start(),
masm.instruction_size());
}
#endif // V8_OS_WIN_X64

View File

@ -673,7 +673,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
base::Memcpy(cached_line, line, CachePage::kLineLength);
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
@ -778,14 +778,14 @@ double Simulator::get_double_from_register_pair(int reg) {
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[2 * sizeof(vfp_registers_[0])];
base::Memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
base::Memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
return (dm_val);
}
void Simulator::set_register_pair_from_double(int reg, double* value) {
DCHECK((reg >= 0) && (reg < num_registers) && ((reg % 2) == 0));
base::Memcpy(registers_ + reg, value, sizeof(*value));
memcpy(registers_ + reg, value, sizeof(*value));
}
void Simulator::set_dw_register(int dreg, const int* dbl) {
@ -796,22 +796,22 @@ void Simulator::set_dw_register(int dreg, const int* dbl) {
void Simulator::get_d_register(int dreg, uint64_t* value) {
DCHECK((dreg >= 0) && (dreg < DwVfpRegister::SupportedRegisterCount()));
base::Memcpy(value, vfp_registers_ + dreg * 2, sizeof(*value));
memcpy(value, vfp_registers_ + dreg * 2, sizeof(*value));
}
void Simulator::set_d_register(int dreg, const uint64_t* value) {
DCHECK((dreg >= 0) && (dreg < DwVfpRegister::SupportedRegisterCount()));
base::Memcpy(vfp_registers_ + dreg * 2, value, sizeof(*value));
memcpy(vfp_registers_ + dreg * 2, value, sizeof(*value));
}
void Simulator::get_d_register(int dreg, uint32_t* value) {
DCHECK((dreg >= 0) && (dreg < DwVfpRegister::SupportedRegisterCount()));
base::Memcpy(value, vfp_registers_ + dreg * 2, sizeof(*value) * 2);
memcpy(value, vfp_registers_ + dreg * 2, sizeof(*value) * 2);
}
void Simulator::set_d_register(int dreg, const uint32_t* value) {
DCHECK((dreg >= 0) && (dreg < DwVfpRegister::SupportedRegisterCount()));
base::Memcpy(vfp_registers_ + dreg * 2, value, sizeof(*value) * 2);
memcpy(vfp_registers_ + dreg * 2, value, sizeof(*value) * 2);
}
template <typename T, int SIZE>
@ -819,7 +819,7 @@ void Simulator::get_neon_register(int reg, T (&value)[SIZE / sizeof(T)]) {
DCHECK(SIZE == kSimd128Size || SIZE == kDoubleSize);
DCHECK_LE(0, reg);
DCHECK_GT(SIZE == kSimd128Size ? num_q_registers : num_d_registers, reg);
base::Memcpy(value, vfp_registers_ + reg * (SIZE / 4), SIZE);
memcpy(value, vfp_registers_ + reg * (SIZE / 4), SIZE);
}
template <typename T, int SIZE>
@ -827,7 +827,7 @@ void Simulator::set_neon_register(int reg, const T (&value)[SIZE / sizeof(T)]) {
DCHECK(SIZE == kSimd128Size || SIZE == kDoubleSize);
DCHECK_LE(0, reg);
DCHECK_GT(SIZE == kSimd128Size ? num_q_registers : num_d_registers, reg);
base::Memcpy(vfp_registers_ + reg * (SIZE / 4), value, SIZE);
memcpy(vfp_registers_ + reg * (SIZE / 4), value, SIZE);
}
// Raw access to the PC register.
@ -863,7 +863,7 @@ void Simulator::SetVFPRegister(int reg_index, const InputType& value) {
if (register_size == 2)
DCHECK(reg_index < DwVfpRegister::SupportedRegisterCount());
base::Memcpy(&vfp_registers_[reg_index * register_size], &value, bytes);
memcpy(&vfp_registers_[reg_index * register_size], &value, bytes);
}
template <class ReturnType, int register_size>
@ -876,7 +876,7 @@ ReturnType Simulator::GetFromVFPRegister(int reg_index) {
DCHECK(reg_index < DwVfpRegister::SupportedRegisterCount());
ReturnType value;
base::Memcpy(&value, &vfp_registers_[register_size * reg_index], bytes);
memcpy(&value, &vfp_registers_[register_size * reg_index], bytes);
return value;
}
@ -930,14 +930,14 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) {
void Simulator::SetFpResult(const double& result) {
if (use_eabi_hardfloat()) {
char buffer[2 * sizeof(vfp_registers_[0])];
base::Memcpy(buffer, &result, sizeof(buffer));
memcpy(buffer, &result, sizeof(buffer));
// Copy result to d0.
base::Memcpy(vfp_registers_, buffer, sizeof(buffer));
memcpy(vfp_registers_, buffer, sizeof(buffer));
} else {
char buffer[2 * sizeof(registers_[0])];
base::Memcpy(buffer, &result, sizeof(buffer));
memcpy(buffer, &result, sizeof(buffer));
// Copy result to r0 and r1.
base::Memcpy(registers_, buffer, sizeof(buffer));
memcpy(registers_, buffer, sizeof(buffer));
}
}
@ -3457,7 +3457,7 @@ void Simulator::DecodeTypeVFP(Instruction* instr) {
// NeonS32 / NeonU32
DCHECK_EQ(0, instr->Bit(23));
int32_t int_data[2];
base::Memcpy(int_data, &data, sizeof(int_data));
memcpy(int_data, &data, sizeof(int_data));
set_register(rt, int_data[instr->Bit(21)]);
} else {
uint64_t data;
@ -4098,7 +4098,7 @@ void VmovImmediate(Simulator* simulator, Instruction* instr) {
// Set all bytes of register.
std::fill_n(imms, kSimd128Size, imm);
uint64_t imm64;
base::Memcpy(&imm64, imms, 8);
memcpy(&imm64, imms, 8);
for (int r = 0; r < regs; r++) {
simulator->set_d_register(vd + r, &imm64);
}
@ -4314,9 +4314,9 @@ void MultiplyLong(Simulator* simulator, int Vd, int Vn, int Vm) {
// underlying datatype easily.
uint64_t tmp;
simulator->get_d_register(Vn, &tmp);
base::Memcpy(src1, &tmp, sizeof(tmp));
memcpy(src1, &tmp, sizeof(tmp));
simulator->get_d_register(Vm, &tmp);
base::Memcpy(src2, &tmp, sizeof(tmp));
memcpy(src2, &tmp, sizeof(tmp));
for (int i = 0; i < kElems; i++) {
dst[i] = WideType{src1[i]} * WideType{src2[i]};
@ -6279,9 +6279,8 @@ intptr_t Simulator::CallImpl(Address entry, int argument_count,
entry_stack &= -base::OS::ActivationFrameAlignment();
}
// Store remaining arguments on stack, from low to high memory.
base::Memcpy(reinterpret_cast<intptr_t*>(entry_stack),
arguments + reg_arg_count,
(argument_count - reg_arg_count) * sizeof(*arguments));
memcpy(reinterpret_cast<intptr_t*>(entry_stack), arguments + reg_arg_count,
(argument_count - reg_arg_count) * sizeof(*arguments));
set_register(sp, entry_stack);
CallInternal(entry);

View File

@ -145,7 +145,7 @@ void Simulator::CallImpl(Address entry, CallArgument* args) {
char* stack = reinterpret_cast<char*>(entry_stack);
std::vector<int64_t>::const_iterator it;
for (it = stack_args.begin(); it != stack_args.end(); it++) {
base::Memcpy(stack, &(*it), sizeof(*it));
memcpy(stack, &(*it), sizeof(*it));
stack += sizeof(*it);
}
@ -268,9 +268,9 @@ uintptr_t Simulator::PushAddress(uintptr_t address) {
DCHECK(sizeof(uintptr_t) < 2 * kXRegSize);
intptr_t new_sp = sp() - 2 * kXRegSize;
uintptr_t* alignment_slot = reinterpret_cast<uintptr_t*>(new_sp + kXRegSize);
base::Memcpy(alignment_slot, &kSlotsZapValue, kSystemPointerSize);
memcpy(alignment_slot, &kSlotsZapValue, kSystemPointerSize);
uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(new_sp);
base::Memcpy(stack_slot, &address, kSystemPointerSize);
memcpy(stack_slot, &address, kSystemPointerSize);
set_sp(new_sp);
return new_sp;
}
@ -3628,10 +3628,9 @@ void Simulator::VisitException(Instruction* instr) {
uint32_t code;
uint32_t parameters;
base::Memcpy(&code, pc_->InstructionAtOffset(kDebugCodeOffset),
sizeof(code));
base::Memcpy(&parameters, pc_->InstructionAtOffset(kDebugParamsOffset),
sizeof(parameters));
memcpy(&code, pc_->InstructionAtOffset(kDebugCodeOffset), sizeof(code));
memcpy(&parameters, pc_->InstructionAtOffset(kDebugParamsOffset),
sizeof(parameters));
char const* message = reinterpret_cast<char const*>(
pc_->InstructionAtOffset(kDebugMessageOffset));
@ -5850,9 +5849,9 @@ void Simulator::DoPrintf(Instruction* instr) {
uint32_t arg_count;
uint32_t arg_pattern_list;
STATIC_ASSERT(sizeof(*instr) == 1);
base::Memcpy(&arg_count, instr + kPrintfArgCountOffset, sizeof(arg_count));
base::Memcpy(&arg_pattern_list, instr + kPrintfArgPatternListOffset,
sizeof(arg_pattern_list));
memcpy(&arg_count, instr + kPrintfArgCountOffset, sizeof(arg_count));
memcpy(&arg_pattern_list, instr + kPrintfArgPatternListOffset,
sizeof(arg_pattern_list));
DCHECK_LE(arg_count, kPrintfMaxArgCount);
DCHECK_EQ(arg_pattern_list >> (kPrintfArgPatternBits * arg_count), 0);

View File

@ -251,7 +251,7 @@ class SimMemory {
DCHECK((sizeof(value) == 1) || (sizeof(value) == 2) ||
(sizeof(value) == 4) || (sizeof(value) == 8) ||
(sizeof(value) == 16));
base::Memcpy(&value, reinterpret_cast<const char*>(address), sizeof(value));
memcpy(&value, reinterpret_cast<const char*>(address), sizeof(value));
return value;
}
@ -261,7 +261,7 @@ class SimMemory {
DCHECK((sizeof(value) == 1) || (sizeof(value) == 2) ||
(sizeof(value) == 4) || (sizeof(value) == 8) ||
(sizeof(value) == 16));
base::Memcpy(reinterpret_cast<char*>(address), &value, sizeof(value));
memcpy(reinterpret_cast<char*>(address), &value, sizeof(value));
}
};
@ -327,7 +327,7 @@ class SimRegisterBase {
// All AArch64 registers are zero-extending.
memset(value_ + sizeof(new_value), 0, kSizeInBytes - sizeof(new_value));
}
base::Memcpy(&value_, &new_value, sizeof(T));
memcpy(&value_, &new_value, sizeof(T));
NotifyRegisterWrite();
}
@ -340,8 +340,7 @@ class SimRegisterBase {
DCHECK_GE(lane, 0);
DCHECK_LE(sizeof(new_value) + (lane * sizeof(new_value)),
static_cast<unsigned>(kSizeInBytes));
base::Memcpy(&value_[lane * sizeof(new_value)], &new_value,
sizeof(new_value));
memcpy(&value_[lane * sizeof(new_value)], &new_value, sizeof(new_value));
NotifyRegisterWrite();
}
@ -351,7 +350,7 @@ class SimRegisterBase {
DCHECK_GE(lane, 0);
DCHECK_LE(sizeof(result) + (lane * sizeof(result)),
static_cast<unsigned>(kSizeInBytes));
base::Memcpy(&result, &value_[lane * sizeof(result)], sizeof(result));
memcpy(&result, &value_[lane * sizeof(result)], sizeof(result));
return result;
}
@ -439,7 +438,7 @@ class LogicVRegister {
int64_t IntLeftJustified(VectorFormat vform, int index) const {
uint64_t value = UintLeftJustified(vform, index);
int64_t result;
base::Memcpy(&result, &value, sizeof(result));
memcpy(&result, &value, sizeof(result));
return result;
}
@ -675,13 +674,13 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
explicit CallArgument(T argument) {
bits_ = 0;
DCHECK(sizeof(argument) <= sizeof(bits_));
base::Memcpy(&bits_, &argument, sizeof(argument));
memcpy(&bits_, &argument, sizeof(argument));
type_ = X_ARG;
}
explicit CallArgument(double argument) {
DCHECK(sizeof(argument) == sizeof(bits_));
base::Memcpy(&bits_, &argument, sizeof(argument));
memcpy(&bits_, &argument, sizeof(argument));
type_ = D_ARG;
}
@ -692,10 +691,10 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
// Make the D register a NaN to try to trap errors if the callee expects a
// double. If it expects a float, the callee should ignore the top word.
DCHECK(sizeof(kFP64SignallingNaN) == sizeof(bits_));
base::Memcpy(&bits_, &kFP64SignallingNaN, sizeof(kFP64SignallingNaN));
memcpy(&bits_, &kFP64SignallingNaN, sizeof(kFP64SignallingNaN));
// Write the float payload to the S register.
DCHECK(sizeof(argument) <= sizeof(bits_));
base::Memcpy(&bits_, &argument, sizeof(argument));
memcpy(&bits_, &argument, sizeof(argument));
type_ = D_ARG;
}
@ -763,7 +762,7 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
template <typename T>
void set_pc(T new_pc) {
DCHECK(sizeof(T) == sizeof(pc_));
base::Memcpy(&pc_, &new_pc, sizeof(T));
memcpy(&pc_, &new_pc, sizeof(T));
pc_modified_ = true;
}
Instruction* pc() { return pc_; }
@ -1055,7 +1054,7 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
static_assert(sizeof(result) <= sizeof(raw),
"Template type must be <= 64 bits.");
// Copy the result and truncate to fit. This assumes a little-endian host.
base::Memcpy(&result, &raw, sizeof(result));
memcpy(&result, &raw, sizeof(result));
return result;
}
@ -1510,7 +1509,7 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
STATIC_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) ||
(sizeof(value) == 4) || (sizeof(value) == 8) ||
(sizeof(value) == 16));
base::Memcpy(&value, reinterpret_cast<const void*>(address), sizeof(value));
memcpy(&value, reinterpret_cast<const void*>(address), sizeof(value));
return value;
}
@ -1520,7 +1519,7 @@ class Simulator : public DecoderVisitor, public SimulatorBase {
STATIC_ASSERT((sizeof(value) == 1) || (sizeof(value) == 2) ||
(sizeof(value) == 4) || (sizeof(value) == 8) ||
(sizeof(value) == 16));
base::Memcpy(reinterpret_cast<void*>(address), &value, sizeof(value));
memcpy(reinterpret_cast<void*>(address), &value, sizeof(value));
}
template <typename T>

View File

@ -1869,7 +1869,7 @@ void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
const int kMaxPrintedFunctionName = 64;
char func_name[kMaxPrintedFunctionName + 1];
int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length());
base::Memcpy(func_name, raw_func_name.begin(), func_name_len);
memcpy(func_name, raw_func_name.begin(), func_name_len);
func_name[func_name_len] = '\0';
int pos = position();
const wasm::WasmModule* module = wasm_instance().module_object().module();

View File

@ -850,7 +850,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
base::Memcpy(cached_line, line, CachePage::kLineLength);
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
@ -990,8 +990,8 @@ double Simulator::get_double_from_register_pair(int reg) {
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[2 * sizeof(registers_[0])];
base::Memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
base::Memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
return (dm_val);
}
@ -1044,13 +1044,13 @@ double Simulator::get_fpu_register_double(int fpureg) const {
template <typename T>
void Simulator::get_msa_register(int wreg, T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
base::Memcpy(value, FPUregisters_ + wreg * 2, kSimd128Size);
memcpy(value, FPUregisters_ + wreg * 2, kSimd128Size);
}
template <typename T>
void Simulator::set_msa_register(int wreg, const T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
base::Memcpy(FPUregisters_ + wreg * 2, value, kSimd128Size);
memcpy(FPUregisters_ + wreg * 2, value, kSimd128Size);
}
// Runtime FP routines take up to two double arguments and zero
@ -1071,14 +1071,14 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) {
// Registers a0 and a1 -> x.
reg_buffer[0] = get_register(a0);
reg_buffer[1] = get_register(a1);
base::Memcpy(x, buffer, sizeof(buffer));
memcpy(x, buffer, sizeof(buffer));
// Registers a2 and a3 -> y.
reg_buffer[0] = get_register(a2);
reg_buffer[1] = get_register(a3);
base::Memcpy(y, buffer, sizeof(buffer));
memcpy(y, buffer, sizeof(buffer));
// Register 2 -> z.
reg_buffer[0] = get_register(a2);
base::Memcpy(z, buffer, sizeof(*z));
memcpy(z, buffer, sizeof(*z));
}
}
@ -1089,7 +1089,7 @@ void Simulator::SetFpResult(const double& result) {
} else {
char buffer[2 * sizeof(registers_[0])];
int32_t* reg_buffer = reinterpret_cast<int32_t*>(buffer);
base::Memcpy(buffer, &result, sizeof(buffer));
memcpy(buffer, &result, sizeof(buffer));
// Copy result to v0 and v1.
set_register(v0, reg_buffer[0]);
set_register(v1, reg_buffer[1]);
@ -1688,7 +1688,7 @@ void Simulator::TraceMSARegWr(T* value, TraceType t) {
float f[4];
double df[2];
} v;
base::Memcpy(v.b, value, kSimd128Size);
memcpy(v.b, value, kSimd128Size);
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
@ -1741,7 +1741,7 @@ void Simulator::TraceMSARegWr(T* value) {
float f[kMSALanesWord];
double df[kMSALanesDword];
} v;
base::Memcpy(v.b, value, kMSALanesByte);
memcpy(v.b, value, kMSALanesByte);
if (std::is_same<T, int32_t>::value) {
SNPrintF(trace_buf_,
@ -7063,8 +7063,8 @@ intptr_t Simulator::CallImpl(Address entry, int argument_count,
}
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
base::Memcpy(stack_argument + kCArgSlotCount, arguments + reg_arg_count,
(argument_count - reg_arg_count) * sizeof(*arguments));
memcpy(stack_argument + kCArgSlotCount, arguments + reg_arg_count,
(argument_count - reg_arg_count) * sizeof(*arguments));
set_register(sp, entry_stack);
CallInternal(entry);
@ -7083,9 +7083,9 @@ double Simulator::CallFP(Address entry, double d0, double d1) {
} else {
int buffer[2];
DCHECK(sizeof(buffer[0]) * 2 == sizeof(d0));
base::Memcpy(buffer, &d0, sizeof(d0));
memcpy(buffer, &d0, sizeof(d0));
set_dw_register(a0, buffer);
base::Memcpy(buffer, &d1, sizeof(d1));
memcpy(buffer, &d1, sizeof(d1));
set_dw_register(a2, buffer);
}
CallInternal(entry);

View File

@ -791,7 +791,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
base::Memcpy(cached_line, line, CachePage::kLineLength);
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
@ -932,8 +932,8 @@ double Simulator::get_double_from_register_pair(int reg) {
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[sizeof(registers_[0])];
base::Memcpy(buffer, &registers_[reg], sizeof(registers_[0]));
base::Memcpy(&dm_val, buffer, sizeof(registers_[0]));
memcpy(buffer, &registers_[reg], sizeof(registers_[0]));
memcpy(&dm_val, buffer, sizeof(registers_[0]));
return (dm_val);
}
@ -970,13 +970,13 @@ double Simulator::get_fpu_register_double(int fpureg) const {
template <typename T>
void Simulator::get_msa_register(int wreg, T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
base::Memcpy(value, FPUregisters_ + wreg * 2, kSimd128Size);
memcpy(value, FPUregisters_ + wreg * 2, kSimd128Size);
}
template <typename T>
void Simulator::set_msa_register(int wreg, const T* value) {
DCHECK((wreg >= 0) && (wreg < kNumMSARegisters));
base::Memcpy(FPUregisters_ + wreg * 2, value, kSimd128Size);
memcpy(FPUregisters_ + wreg * 2, value, kSimd128Size);
}
// Runtime FP routines take up to two double arguments and zero
@ -998,14 +998,14 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) {
// Registers a0 and a1 -> x.
reg_buffer[0] = get_register(a0);
reg_buffer[1] = get_register(a1);
base::Memcpy(x, buffer, sizeof(buffer));
memcpy(x, buffer, sizeof(buffer));
// Registers a2 and a3 -> y.
reg_buffer[0] = get_register(a2);
reg_buffer[1] = get_register(a3);
base::Memcpy(y, buffer, sizeof(buffer));
memcpy(y, buffer, sizeof(buffer));
// Register 2 -> z.
reg_buffer[0] = get_register(a2);
base::Memcpy(z, buffer, sizeof(*z));
memcpy(z, buffer, sizeof(*z));
}
}
@ -1016,7 +1016,7 @@ void Simulator::SetFpResult(const double& result) {
} else {
char buffer[2 * sizeof(registers_[0])];
int64_t* reg_buffer = reinterpret_cast<int64_t*>(buffer);
base::Memcpy(buffer, &result, sizeof(buffer));
memcpy(buffer, &result, sizeof(buffer));
// Copy result to v0 and v1.
set_register(v0, reg_buffer[0]);
set_register(v1, reg_buffer[1]);
@ -1625,7 +1625,7 @@ void Simulator::TraceMSARegWr(T* value, TraceType t) {
float f[4];
double df[2];
} v;
base::Memcpy(v.b, value, kSimd128Size);
memcpy(v.b, value, kSimd128Size);
switch (t) {
case BYTE:
SNPrintF(trace_buf_,
@ -1678,7 +1678,7 @@ void Simulator::TraceMSARegWr(T* value) {
float f[kMSALanesWord];
double df[kMSALanesDword];
} v;
base::Memcpy(v.b, value, kMSALanesByte);
memcpy(v.b, value, kMSALanesByte);
if (std::is_same<T, int32_t>::value) {
SNPrintF(trace_buf_,
@ -7482,8 +7482,8 @@ intptr_t Simulator::CallImpl(Address entry, int argument_count,
}
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
base::Memcpy(stack_argument + kCArgSlotCount, arguments + reg_arg_count,
stack_args_count * sizeof(*arguments));
memcpy(stack_argument + kCArgSlotCount, arguments + reg_arg_count,
stack_args_count * sizeof(*arguments));
set_register(sp, entry_stack);
CallInternal(entry);
@ -7503,9 +7503,9 @@ double Simulator::CallFP(Address entry, double d0, double d1) {
} else {
int buffer[2];
DCHECK(sizeof(buffer[0]) * 2 == sizeof(d0));
base::Memcpy(buffer, &d0, sizeof(d0));
memcpy(buffer, &d0, sizeof(d0));
set_dw_register(a0, buffer);
base::Memcpy(buffer, &d1, sizeof(d1));
memcpy(buffer, &d1, sizeof(d1));
set_dw_register(a2, buffer);
}
CallInternal(entry);

View File

@ -716,7 +716,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
cache_page->CachedData(offset), kInstrSize));
} else {
// Cache miss. Load memory into the cache.
base::Memcpy(cached_line, line, CachePage::kLineLength);
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
@ -802,8 +802,8 @@ double Simulator::get_double_from_register_pair(int reg) {
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[sizeof(fp_registers_[0])];
base::Memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
base::Memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
#endif
return (dm_val);
}
@ -1195,8 +1195,8 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
set_register(r3, x);
set_register(r4, y);
} else {
base::Memcpy(reinterpret_cast<void*>(result_buffer), &result,
sizeof(ObjectPair));
memcpy(reinterpret_cast<void*>(result_buffer), &result,
sizeof(ObjectPair));
set_register(r3, result_buffer);
}
} else {
@ -5172,8 +5172,8 @@ intptr_t Simulator::CallImpl(Address entry, int argument_count,
// +2 is a hack for the LR slot + old SP on PPC
intptr_t* stack_argument =
reinterpret_cast<intptr_t*>(entry_stack) + kStackFrameExtraParamSlot;
base::Memcpy(stack_argument, arguments + reg_arg_count,
stack_arg_count * sizeof(*arguments));
memcpy(stack_argument, arguments + reg_arg_count,
stack_arg_count * sizeof(*arguments));
set_register(sp, entry_stack);
CallInternal(entry);

View File

@ -287,7 +287,7 @@ class Simulator : public SimulatorBase {
template <typename T>
inline void Read(uintptr_t address, T* value) {
base::MutexGuard lock_guard(&GlobalMonitor::Get()->mutex);
base::Memcpy(value, reinterpret_cast<const char*>(address), sizeof(T));
memcpy(value, reinterpret_cast<const char*>(address), sizeof(T));
}
template <typename T>
@ -296,7 +296,7 @@ class Simulator : public SimulatorBase {
GlobalMonitor::Get()->NotifyLoadExcl(
address, static_cast<TransactionSize>(sizeof(T)),
isolate_->thread_id());
base::Memcpy(value, reinterpret_cast<const char*>(address), sizeof(T));
memcpy(value, reinterpret_cast<const char*>(address), sizeof(T));
}
template <typename T>
@ -305,7 +305,7 @@ class Simulator : public SimulatorBase {
GlobalMonitor::Get()->NotifyStore(address,
static_cast<TransactionSize>(sizeof(T)),
isolate_->thread_id());
base::Memcpy(reinterpret_cast<char*>(address), &value, sizeof(T));
memcpy(reinterpret_cast<char*>(address), &value, sizeof(T));
}
template <typename T>
@ -314,7 +314,7 @@ class Simulator : public SimulatorBase {
if (GlobalMonitor::Get()->NotifyStoreExcl(
address, static_cast<TransactionSize>(sizeof(T)),
isolate_->thread_id())) {
base::Memcpy(reinterpret_cast<char*>(address), &value, sizeof(T));
memcpy(reinterpret_cast<char*>(address), &value, sizeof(T));
return 0;
} else {
return 1;

View File

@ -735,7 +735,7 @@ void Simulator::CheckICache(base::CustomMatcherHashMap* i_cache,
0);
} else {
// Cache miss. Load memory into the cache.
base::Memcpy(cached_line, line, CachePage::kLineLength);
memcpy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
@ -1734,8 +1734,8 @@ double Simulator::get_double_from_register_pair(int reg) {
// Read the bits from the unsigned integer register_[] array
// into the double precision floating point value and return it.
char buffer[sizeof(fp_registers_[0])];
base::Memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
base::Memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
memcpy(buffer, &registers_[reg], 2 * sizeof(registers_[0]));
memcpy(&dm_val, buffer, 2 * sizeof(registers_[0]));
#endif
return (dm_val);
}
@ -2200,8 +2200,8 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
set_register(r2, x);
set_register(r3, y);
} else {
base::Memcpy(reinterpret_cast<void*>(result_buffer), &result,
sizeof(ObjectPair));
memcpy(reinterpret_cast<void*>(result_buffer), &result,
sizeof(ObjectPair));
set_register(r2, result_buffer);
}
} else {
@ -2602,8 +2602,8 @@ intptr_t Simulator::CallImpl(Address entry, int argument_count,
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument =
reinterpret_cast<intptr_t*>(entry_stack + kCalleeRegisterSaveAreaSize);
base::Memcpy(stack_argument, arguments + reg_arg_count,
stack_arg_count * sizeof(*arguments));
memcpy(stack_argument, arguments + reg_arg_count,
stack_arg_count * sizeof(*arguments));
set_register(sp, entry_stack);
// Prepare to execute the code at entry

View File

@ -4926,12 +4926,12 @@ void Heap::ConfigureHeap(const v8::ResourceConstraints& constraints) {
void Heap::AddToRingBuffer(const char* string) {
size_t first_part =
std::min(strlen(string), kTraceRingBufferSize - ring_buffer_end_);
base::Memcpy(trace_ring_buffer_ + ring_buffer_end_, string, first_part);
memcpy(trace_ring_buffer_ + ring_buffer_end_, string, first_part);
ring_buffer_end_ += first_part;
if (first_part < strlen(string)) {
ring_buffer_full_ = true;
size_t second_part = strlen(string) - first_part;
base::Memcpy(trace_ring_buffer_, string + first_part, second_part);
memcpy(trace_ring_buffer_, string + first_part, second_part);
ring_buffer_end_ = second_part;
}
}
@ -4940,9 +4940,9 @@ void Heap::GetFromRingBuffer(char* buffer) {
size_t copied = 0;
if (ring_buffer_full_) {
copied = kTraceRingBufferSize - ring_buffer_end_;
base::Memcpy(buffer, trace_ring_buffer_ + ring_buffer_end_, copied);
memcpy(buffer, trace_ring_buffer_ + ring_buffer_end_, copied);
}
base::Memcpy(buffer + copied, trace_ring_buffer_, ring_buffer_end_);
memcpy(buffer + copied, trace_ring_buffer_, ring_buffer_end_);
}
void Heap::ConfigureHeapDefault() {

View File

@ -25,7 +25,7 @@ V8_INLINE static void CopyTraceObjectParameter(char** buffer,
const char** member) {
if (*member == nullptr) return;
size_t length = strlen(*member) + 1;
base::Memcpy(*buffer, *member, length);
memcpy(*buffer, *member, length);
*member = *buffer;
*buffer += length;
}

View File

@ -51,7 +51,7 @@ inline unsigned int FastD2UI(double x) {
reinterpret_cast<void*>(reinterpret_cast<Address>(&x) + kInt32Size);
#endif
// Copy least significant 32 bits of mantissa.
base::Memcpy(&result, mantissa_ptr, sizeof(result));
memcpy(&result, mantissa_ptr, sizeof(result));
return negative ? ~result + 1 : result;
}
// Large number (outside uint32 range), Infinity or NaN.

View File

@ -1349,8 +1349,7 @@ char* DoubleToRadixCString(double value, int radix) {
DCHECK_LE(0, integer_cursor);
// Allocate new string as return value.
char* result = NewArray<char>(fraction_cursor - integer_cursor);
base::Memcpy(result, buffer + integer_cursor,
fraction_cursor - integer_cursor);
memcpy(result, buffer + integer_cursor, fraction_cursor - integer_cursor);
return result;
}

View File

@ -510,8 +510,7 @@ std::unique_ptr<BackingStore> BackingStore::CopyWasmMemory(Isolate* isolate,
// If the allocation was successful, then the new buffer must be at least
// as big as the old one.
DCHECK_GE(new_pages * wasm::kWasmPageSize, byte_length_);
base::Memcpy(new_backing_store->buffer_start(), buffer_start_,
byte_length_);
memcpy(new_backing_store->buffer_start(), buffer_start_, byte_length_);
}
return new_backing_store;

View File

@ -377,10 +377,9 @@ Handle<MutableBigInt> MutableBigInt::Copy(Isolate* isolate,
int length = source->length();
// Allocating a BigInt of the same length as an existing BigInt cannot throw.
Handle<MutableBigInt> result = New(isolate, length).ToHandleChecked();
base::Memcpy(
reinterpret_cast<void*>(result->address() + BigIntBase::kHeaderSize),
reinterpret_cast<void*>(source->address() + BigIntBase::kHeaderSize),
BigInt::SizeFor(length) - BigIntBase::kHeaderSize);
memcpy(reinterpret_cast<void*>(result->address() + BigIntBase::kHeaderSize),
reinterpret_cast<void*>(source->address() + BigIntBase::kHeaderSize),
BigInt::SizeFor(length) - BigIntBase::kHeaderSize);
return result;
}
@ -1956,7 +1955,7 @@ void BigInt::SerializeDigits(uint8_t* storage) {
reinterpret_cast<void*>(ptr() + kDigitsOffset - kHeapObjectTag);
#if defined(V8_TARGET_LITTLE_ENDIAN)
int bytelength = length() * kDigitSize;
base::Memcpy(storage, digits, bytelength);
memcpy(storage, digits, bytelength);
#elif defined(V8_TARGET_BIG_ENDIAN)
digit_t* digit_storage = reinterpret_cast<digit_t*>(storage);
const digit_t* digit = reinterpret_cast<const digit_t*>(digits);
@ -1982,7 +1981,7 @@ MaybeHandle<BigInt> BigInt::FromSerializedDigits(
void* digits =
reinterpret_cast<void*>(result->ptr() + kDigitsOffset - kHeapObjectTag);
#if defined(V8_TARGET_LITTLE_ENDIAN)
base::Memcpy(digits, digits_storage.begin(), bytelength);
memcpy(digits, digits_storage.begin(), bytelength);
void* padding_start =
reinterpret_cast<void*>(reinterpret_cast<Address>(digits) + bytelength);
memset(padding_start, 0, length * kDigitSize - bytelength);

View File

@ -560,14 +560,14 @@ void ByteArray::copy_in(int index, const byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->length());
Address dst_addr = field_address(kHeaderSize + index * kCharSize);
base::Memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
}
void ByteArray::copy_out(int index, byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->length());
Address src_addr = field_address(kHeaderSize + index * kCharSize);
base::Memcpy(buffer, reinterpret_cast<void*>(src_addr), length);
memcpy(buffer, reinterpret_cast<void*>(src_addr), length);
}
int ByteArray::get_int(int index) const {

View File

@ -186,7 +186,7 @@ Handle<JSArrayBuffer> JSTypedArray::GetBuffer() {
// Copy the elements into the backing store of the array buffer.
if (byte_length > 0) {
base::Memcpy(backing_store->buffer_start(), self->DataPtr(), byte_length);
memcpy(backing_store->buffer_start(), self->DataPtr(), byte_length);
}
// Attach the backing store to the array buffer.

View File

@ -65,7 +65,7 @@ void PreparseData::copy_in(int index, const byte* buffer, int length) {
DCHECK(index >= 0 && length >= 0 && length <= kMaxInt - index &&
index + length <= this->data_length());
Address dst_addr = field_address(kDataStartOffset + index * kByteSize);
base::Memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
memcpy(reinterpret_cast<void*>(dst_addr), buffer, length);
}
PreparseData PreparseData::get_child(int index) const {

View File

@ -334,7 +334,7 @@ void ValueSerializer::WriteBigIntContents(BigInt bigint) {
void ValueSerializer::WriteRawBytes(const void* source, size_t length) {
uint8_t* dest;
if (ReserveRawBytes(length).To(&dest) && length > 0) {
base::Memcpy(dest, source, length);
memcpy(dest, source, length);
}
}
@ -1226,7 +1226,7 @@ Maybe<double> ValueDeserializer::ReadDouble() {
if (sizeof(double) > static_cast<unsigned>(end_ - position_))
return Nothing<double>();
double value;
base::Memcpy(&value, position_, sizeof(double));
memcpy(&value, position_, sizeof(double));
position_ += sizeof(double);
if (std::isnan(value)) value = std::numeric_limits<double>::quiet_NaN();
return Just(value);
@ -1465,7 +1465,7 @@ MaybeHandle<String> ValueDeserializer::ReadTwoByteString() {
// Copy the bytes directly into the new string.
// Warning: this uses host endianness.
DisallowGarbageCollection no_gc;
base::Memcpy(string->GetChars(no_gc), bytes.begin(), bytes.length());
memcpy(string->GetChars(no_gc), bytes.begin(), bytes.length());
return string;
}
@ -1826,7 +1826,7 @@ MaybeHandle<JSArrayBuffer> ValueDeserializer::ReadJSArrayBuffer(
if (!result.ToHandle(&array_buffer)) return result;
if (byte_length > 0) {
base::Memcpy(array_buffer->backing_store(), position_, byte_length);
memcpy(array_buffer->backing_store(), position_, byte_length);
}
position_ += byte_length;
AddObjectWithID(id, array_buffer);

View File

@ -134,7 +134,7 @@ struct RawPreparseData {};
void PreparseDataBuilder::ByteData::Finalize(Zone* zone) {
uint8_t* raw_zone_data = zone->NewArray<uint8_t, RawPreparseData>(index_);
base::Memcpy(raw_zone_data, byte_data_->data(), index_);
memcpy(raw_zone_data, byte_data_->data(), index_);
byte_data_->resize(0);
zone_byte_data_ = Vector<uint8_t>(raw_zone_data, index_);
#ifdef DEBUG

View File

@ -1046,7 +1046,7 @@ const char* Scanner::CurrentLiteralAsCString(Zone* zone) const {
Vector<const uint8_t> vector = literal_one_byte_string();
int length = vector.length();
char* buffer = zone->NewArray<char>(length + 1);
base::Memcpy(buffer, vector.begin(), length);
memcpy(buffer, vector.begin(), length);
buffer[length] = '\0';
return buffer;
}

View File

@ -264,8 +264,8 @@ const Runtime::Function* Runtime::RuntimeFunctionTable(Isolate* isolate) {
if (!isolate->runtime_state()->redirected_intrinsic_functions()) {
size_t function_count = arraysize(kIntrinsicFunctions);
Function* redirected_functions = new Function[function_count];
base::Memcpy(redirected_functions, kIntrinsicFunctions,
sizeof(kIntrinsicFunctions));
memcpy(redirected_functions, kIntrinsicFunctions,
sizeof(kIntrinsicFunctions));
for (size_t i = 0; i < function_count; i++) {
ExternalReference redirected_entry =
ExternalReference::Create(static_cast<Runtime::FunctionId>(i));

View File

@ -192,7 +192,7 @@ class SlotAccessorForHandle {
template <typename TSlot>
int Deserializer::WriteAddress(TSlot dest, Address value) {
DCHECK(!next_reference_is_weak_);
base::Memcpy(dest.ToVoidPtr(), &value, kSystemPointerSize);
memcpy(dest.ToVoidPtr(), &value, kSystemPointerSize);
STATIC_ASSERT(IsAligned(kSystemPointerSize, TSlot::kSlotDataSize));
return (kSystemPointerSize / TSlot::kSlotDataSize);
}

View File

@ -60,11 +60,11 @@ int PlatformEmbeddedFileWriterBase::WriteByteChunk(const uint8_t* data) {
break;
case 16:
#ifdef V8_TARGET_BIG_ENDIAN
base::Memcpy(&high, data, kHalfSize);
base::Memcpy(&low, data + kHalfSize, kHalfSize);
memcpy(&high, data, kHalfSize);
memcpy(&low, data + kHalfSize, kHalfSize);
#else
base::Memcpy(&high, data + kHalfSize, kHalfSize);
base::Memcpy(&low, data, kHalfSize);
memcpy(&high, data + kHalfSize, kHalfSize);
memcpy(&low, data, kHalfSize);
#endif // V8_TARGET_BIG_ENDIAN
break;
default:

View File

@ -52,7 +52,7 @@ class SnapshotByteSource final {
void Advance(int by) { position_ += by; }
void CopyRaw(void* to, int number_of_bytes) {
base::Memcpy(to, data_ + position_, number_of_bytes);
memcpy(to, data_ + position_, number_of_bytes);
position_ += number_of_bytes;
}
@ -62,7 +62,7 @@ class SnapshotByteSource final {
for (base::AtomicWord* p = start; p < end;
++p, position_ += sizeof(base::AtomicWord)) {
base::AtomicWord val;
base::Memcpy(&val, data_ + position_, sizeof(base::AtomicWord));
memcpy(&val, data_ + position_, sizeof(base::AtomicWord));
base::Relaxed_Store(p, val);
}
}
@ -74,7 +74,7 @@ class SnapshotByteSource final {
for (AtomicTagged_t* p = start; p < end;
++p, position_ += sizeof(AtomicTagged_t)) {
AtomicTagged_t val;
base::Memcpy(&val, data_ + position_, sizeof(AtomicTagged_t));
memcpy(&val, data_ + position_, sizeof(AtomicTagged_t));
base::Relaxed_Store(p, val);
}
}

View File

@ -442,7 +442,7 @@ SetTraceValue(T arg, unsigned char* type, uint64_t* value) {
*type = value_type_id; \
*value = 0; \
STATIC_ASSERT(sizeof(arg) <= sizeof(*value)); \
base::Memcpy(value, &arg, sizeof(arg)); \
memcpy(value, &arg, sizeof(arg)); \
}
INTERNAL_DECLARE_SET_TRACE_VALUE(double, TRACE_VALUE_TYPE_DOUBLE)
INTERNAL_DECLARE_SET_TRACE_VALUE(const void*, TRACE_VALUE_TYPE_POINTER)

View File

@ -45,7 +45,7 @@ using MemCopyUint8Function = void (*)(uint8_t* dest, const uint8_t* src,
V8_EXPORT_PRIVATE extern MemCopyUint8Function memcopy_uint8_function;
V8_INLINE void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src,
size_t chars) {
base::Memcpy(dest, src, chars);
memcpy(dest, src, chars);
}
// For values < 16, the assembler function is slower than the inlined C code.
const size_t kMinComplexMemCopy = 16;
@ -66,7 +66,7 @@ using MemCopyUint8Function = void (*)(uint8_t* dest, const uint8_t* src,
V8_EXPORT_PRIVATE extern MemCopyUint8Function memcopy_uint8_function;
V8_INLINE void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src,
size_t chars) {
base::Memcpy(dest, src, chars);
memcpy(dest, src, chars);
}
// For values < 16, the assembler function is slower than the inlined C code.
const size_t kMinComplexMemCopy = 16;
@ -85,9 +85,9 @@ inline void MemCopy(void* dest, const void* src, size_t size) {
// fixed sizes to a sequence of move instructions. This avoids the overhead of
// the general {memcpy} function.
switch (size) {
#define CASE(N) \
case N: \
base::Memcpy(dest, src, N); \
#define CASE(N) \
case N: \
memcpy(dest, src, N); \
return;
CASE(1)
CASE(2)
@ -107,7 +107,7 @@ inline void MemCopy(void* dest, const void* src, size_t size) {
CASE(16)
#undef CASE
default:
base::Memcpy(dest, src, size);
memcpy(dest, src, size);
return;
}
}

View File

@ -3831,7 +3831,7 @@ void LiftoffAssembler::emit_f64x2_le(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
const uint8_t imms[16]) {
uint64_t vals[2];
base::Memcpy(vals, imms, sizeof(vals));
memcpy(vals, imms, sizeof(vals));
vmov(dst.low_fp(), Double(vals[0]));
vmov(dst.high_fp(), Double(vals[1]));
}

View File

@ -2842,7 +2842,7 @@ void LiftoffAssembler::emit_f64x2_le(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
const uint8_t imms[16]) {
uint64_t vals[2];
base::Memcpy(vals, imms, sizeof(vals));
memcpy(vals, imms, sizeof(vals));
Movi(dst.fp().V16B(), vals[1], vals[0]);
}

View File

@ -3245,7 +3245,7 @@ void LiftoffAssembler::emit_f64x2_le(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
const uint8_t imms[16]) {
uint64_t vals[2];
base::Memcpy(vals, imms, sizeof(vals));
memcpy(vals, imms, sizeof(vals));
TurboAssembler::Move(dst.fp(), vals[0]);
uint64_t high = vals[1];

View File

@ -3926,7 +3926,7 @@ class LiftoffCompiler {
LiftoffRegister dst = __ GetUnusedRegister(result_rc, {lhs, rhs}, {});
uint8_t shuffle[kSimd128Size];
base::Memcpy(shuffle, imm.value, sizeof(shuffle));
memcpy(shuffle, imm.value, sizeof(shuffle));
bool is_swizzle;
bool needs_swap;
wasm::SimdShuffle::CanonicalizeShuffle(lhs == rhs, shuffle, &needs_swap,

View File

@ -1936,7 +1936,7 @@ void LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
const uint8_t imms[16]) {
MSARegister dst_msa = dst.fp().toW();
uint64_t vals[2];
base::Memcpy(vals, imms, sizeof(vals));
memcpy(vals, imms, sizeof(vals));
li(kScratchReg, vals[0]);
insert_d(dst_msa, 0, kScratchReg);
li(kScratchReg, vals[1]);

View File

@ -2851,7 +2851,7 @@ void LiftoffAssembler::emit_f64x2_le(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_s128_const(LiftoffRegister dst,
const uint8_t imms[16]) {
uint64_t vals[2];
base::Memcpy(vals, imms, sizeof(vals));
memcpy(vals, imms, sizeof(vals));
TurboAssembler::Move(dst.fp(), vals[0]);
movq(kScratchRegister, vals[1]);
Pinsrq(dst.fp(), kScratchRegister, uint8_t{1});

View File

@ -2342,22 +2342,22 @@ struct borrowed_vec {
}
// Vectors with no ownership management of elements
#define WASM_DEFINE_VEC_PLAIN(name, Name) \
WASM_DEFINE_VEC_BASE(name, Name, \
wasm::vec, ) /* NOLINT(whitespace/parens) */ \
\
void wasm_##name##_vec_new(wasm_##name##_vec_t* out, size_t size, \
const wasm_##name##_t data[]) { \
auto v2 = wasm::vec<Name>::make_uninitialized(size); \
if (v2.size() != 0) { \
v8::base::Memcpy(v2.get(), data, size * sizeof(wasm_##name##_t)); \
} \
*out = release_##name##_vec(std::move(v2)); \
} \
\
void wasm_##name##_vec_copy(wasm_##name##_vec_t* out, \
wasm_##name##_vec_t* v) { \
wasm_##name##_vec_new(out, v->size, v->data); \
#define WASM_DEFINE_VEC_PLAIN(name, Name) \
WASM_DEFINE_VEC_BASE(name, Name, \
wasm::vec, ) /* NOLINT(whitespace/parens) */ \
\
void wasm_##name##_vec_new(wasm_##name##_vec_t* out, size_t size, \
const wasm_##name##_t data[]) { \
auto v2 = wasm::vec<Name>::make_uninitialized(size); \
if (v2.size() != 0) { \
memcpy(v2.get(), data, size * sizeof(wasm_##name##_t)); \
} \
*out = release_##name##_vec(std::move(v2)); \
} \
\
void wasm_##name##_vec_copy(wasm_##name##_vec_t* out, \
wasm_##name##_vec_t* v) { \
wasm_##name##_vec_new(out, v->size, v->data); \
}
// Vectors that own their elements

View File

@ -445,7 +445,7 @@ struct ImmF32Immediate {
// returns a float would potentially flip NaN bits per C++ semantics, so we
// have to inline the memcpy call directly.
uint32_t tmp = decoder->read_u32<validate>(pc, "immf32");
base::Memcpy(&value, &tmp, sizeof(value));
memcpy(&value, &tmp, sizeof(value));
}
};
@ -456,7 +456,7 @@ struct ImmF64Immediate {
inline ImmF64Immediate(Decoder* decoder, const byte* pc) {
// Avoid bit_cast because it might not preserve the signalling bit of a NaN.
uint64_t tmp = decoder->read_u64<validate>(pc, "immf64");
base::Memcpy(&value, &tmp, sizeof(value));
memcpy(&value, &tmp, sizeof(value));
}
};

View File

@ -21,7 +21,7 @@ void LocalDeclEncoder::Prepend(Zone* zone, const byte** start,
byte* buffer = zone->NewArray<byte, LocalDeclEncoderBuffer>(Size() + size);
size_t pos = Emit(buffer);
if (size > 0) {
base::Memcpy(buffer + pos, *start, size);
memcpy(buffer + pos, *start, size);
}
pos += size;
*start = buffer;

View File

@ -63,8 +63,7 @@ class V8_EXPORT_PRIVATE AsyncStreamingDecoder : public StreamingDecoder {
1 + length_bytes.length() + payload_length)),
payload_offset_(1 + length_bytes.length()) {
bytes_.start()[0] = id;
base::Memcpy(bytes_.start() + 1, &length_bytes.first(),
length_bytes.length());
memcpy(bytes_.start() + 1, &length_bytes.first(), length_bytes.length());
}
SectionCode section_code() const {
@ -254,7 +253,7 @@ size_t AsyncStreamingDecoder::DecodingState::ReadBytes(
Vector<uint8_t> remaining_buf = buffer() + offset();
size_t num_bytes = std::min(bytes.size(), remaining_buf.size());
TRACE_STREAMING("ReadBytes(%zu bytes)\n", num_bytes);
base::Memcpy(remaining_buf.begin(), &bytes.first(), num_bytes);
memcpy(remaining_buf.begin(), &bytes.first(), num_bytes);
set_offset(offset() + num_bytes);
return num_bytes;
}
@ -290,12 +289,12 @@ void AsyncStreamingDecoder::Finish() {
#define BYTES(x) (x & 0xFF), (x >> 8) & 0xFF, (x >> 16) & 0xFF, (x >> 24) & 0xFF
uint8_t module_header[]{BYTES(kWasmMagic), BYTES(kWasmVersion)};
#undef BYTES
base::Memcpy(cursor, module_header, arraysize(module_header));
memcpy(cursor, module_header, arraysize(module_header));
cursor += arraysize(module_header);
}
for (const auto& buffer : section_buffers_) {
DCHECK_LE(cursor - bytes.start() + buffer->length(), total_size_);
base::Memcpy(cursor, buffer->bytes().begin(), buffer->length());
memcpy(cursor, buffer->bytes().begin(), buffer->length());
cursor += buffer->length();
}
processor_->OnFinishedStream(std::move(bytes));
@ -514,7 +513,7 @@ size_t AsyncStreamingDecoder::DecodeVarInt32::ReadBytes(
Vector<uint8_t> remaining_buf = buf + offset();
size_t new_bytes = std::min(bytes.size(), remaining_buf.size());
TRACE_STREAMING("ReadBytes of a VarInt\n");
base::Memcpy(remaining_buf.begin(), &bytes.first(), new_bytes);
memcpy(remaining_buf.begin(), &bytes.first(), new_bytes);
buf.Truncate(offset() + new_bytes);
Decoder decoder(buf,
streaming->module_offset() - static_cast<uint32_t>(offset()));
@ -628,7 +627,7 @@ AsyncStreamingDecoder::DecodeNumberOfFunctions::NextWithValue(
if (payload_buf.size() < bytes_consumed_) {
return streaming->Error("invalid code section length");
}
base::Memcpy(payload_buf.begin(), buffer().begin(), bytes_consumed_);
memcpy(payload_buf.begin(), buffer().begin(), bytes_consumed_);
// {value} is the number of functions.
if (value_ == 0) {
@ -663,7 +662,7 @@ AsyncStreamingDecoder::DecodeFunctionLength::NextWithValue(
if (fun_length_buffer.size() < bytes_consumed_) {
return streaming->Error("read past code section end");
}
base::Memcpy(fun_length_buffer.begin(), buffer().begin(), bytes_consumed_);
memcpy(fun_length_buffer.begin(), buffer().begin(), bytes_consumed_);
// {value} is the length of the function.
if (value_ == 0) return streaming->Error("invalid function length (0)");

View File

@ -185,7 +185,7 @@ std::unique_ptr<const byte[]> WasmCode::ConcatenateBytes(
byte* ptr = result.get();
for (auto& vec : vectors) {
if (vec.empty()) continue; // Avoid nullptr in {memcpy}.
base::Memcpy(ptr, vec.begin(), vec.size());
memcpy(ptr, vec.begin(), vec.size());
ptr += vec.size();
}
return result;
@ -883,8 +883,8 @@ void NativeModule::ReserveCodeTableForTesting(uint32_t max_functions) {
DCHECK_LE(module_->num_declared_functions, max_functions);
auto new_table = std::make_unique<WasmCode*[]>(max_functions);
if (module_->num_declared_functions > 0) {
base::Memcpy(new_table.get(), code_table_.get(),
module_->num_declared_functions * sizeof(WasmCode*));
memcpy(new_table.get(), code_table_.get(),
module_->num_declared_functions * sizeof(WasmCode*));
}
code_table_ = std::move(new_table);
@ -967,8 +967,7 @@ WasmCode* NativeModule::AddCodeForTesting(Handle<Code> code) {
base::RecursiveMutexGuard guard{&allocation_mutex_};
Vector<uint8_t> dst_code_bytes =
code_allocator_.AllocateForCode(this, instructions.size());
base::Memcpy(dst_code_bytes.begin(), instructions.begin(),
instructions.size());
memcpy(dst_code_bytes.begin(), instructions.begin(), instructions.size());
// Apply the relocation delta by iterating over the RelocInfo.
intptr_t delta = reinterpret_cast<Address>(dst_code_bytes.begin()) -
@ -1096,8 +1095,8 @@ std::unique_ptr<WasmCode> NativeModule::AddCodeWithCodeSpace(
const int instr_size = desc.instr_size;
CODE_SPACE_WRITE_SCOPE
base::Memcpy(dst_code_bytes.begin(), desc.buffer,
static_cast<size_t>(desc.instr_size));
memcpy(dst_code_bytes.begin(), desc.buffer,
static_cast<size_t>(desc.instr_size));
// Apply the relocation delta by iterating over the RelocInfo.
intptr_t delta = dst_code_bytes.begin() - desc.buffer;

View File

@ -631,7 +631,7 @@ void WasmEngine::AsyncCompile(
if (is_shared) {
// Make a copy of the wire bytes to avoid concurrent modification.
std::unique_ptr<uint8_t[]> copy(new uint8_t[bytes.length()]);
base::Memcpy(copy.get(), bytes.start(), bytes.length());
memcpy(copy.get(), bytes.start(), bytes.length());
ModuleWireBytes bytes_copy(copy.get(), copy.get() + bytes.length());
module_object = SyncCompile(isolate, enabled, &thrower, bytes_copy);
} else {
@ -659,7 +659,7 @@ void WasmEngine::AsyncCompile(
// Make a copy of the wire bytes in case the user program changes them
// during asynchronous compilation.
std::unique_ptr<byte[]> copy(new byte[bytes.length()]);
base::Memcpy(copy.get(), bytes.start(), bytes.length());
memcpy(copy.get(), bytes.start(), bytes.length());
AsyncCompileJob* job = CreateAsyncCompileJob(
isolate, enabled, std::move(copy), bytes.length(),

View File

@ -63,7 +63,7 @@ class WasmInitExpr {
immediate_.f64_const = v;
}
explicit WasmInitExpr(uint8_t v[kSimd128Size]) : kind_(kS128Const) {
base::Memcpy(immediate_.s128_const.data(), v, kSimd128Size);
memcpy(immediate_.s128_const.data(), v, kSimd128Size);
}
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(WasmInitExpr);

View File

@ -637,7 +637,7 @@ void WebAssemblyValidate(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (is_shared) {
// Make a copy of the wire bytes to avoid concurrent modification.
std::unique_ptr<uint8_t[]> copy(new uint8_t[bytes.length()]);
base::Memcpy(copy.get(), bytes.start(), bytes.length());
memcpy(copy.get(), bytes.start(), bytes.length());
i::wasm::ModuleWireBytes bytes_copy(copy.get(),
copy.get() + bytes.length());
validated = i_isolate->wasm_engine()->SyncValidate(
@ -680,7 +680,7 @@ void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (is_shared) {
// Make a copy of the wire bytes to avoid concurrent modification.
std::unique_ptr<uint8_t[]> copy(new uint8_t[bytes.length()]);
base::Memcpy(copy.get(), bytes.start(), bytes.length());
memcpy(copy.get(), bytes.start(), bytes.length());
i::wasm::ModuleWireBytes bytes_copy(copy.get(),
copy.get() + bytes.length());
module_obj = i_isolate->wasm_engine()->SyncCompile(

View File

@ -93,7 +93,7 @@ class ZoneBuffer : public ZoneObject {
void write(const byte* data, size_t size) {
if (size == 0) return;
EnsureSpace(size);
base::Memcpy(pos_, data, size);
memcpy(pos_, data, size);
pos_ += size;
}
@ -139,7 +139,7 @@ class ZoneBuffer : public ZoneObject {
if ((pos_ + size) > end_) {
size_t new_size = size + (end_ - buffer_) * 2;
byte* new_buffer = zone_->NewArray<byte, Buffer>(new_size);
base::Memcpy(new_buffer, buffer_, (pos_ - buffer_));
memcpy(new_buffer, buffer_, (pos_ - buffer_));
pos_ = new_buffer + (pos_ - buffer_);
buffer_ = new_buffer;
end_ = new_buffer + new_size;

View File

@ -547,9 +547,9 @@ Handle<JSArray> GetCustomSections(Isolate* isolate,
thrower->RangeError("out of memory allocating custom section data");
return Handle<JSArray>();
}
base::Memcpy(array_buffer->backing_store(),
wire_bytes.begin() + section.payload.offset(),
section.payload.length());
memcpy(array_buffer->backing_store(),
wire_bytes.begin() + section.payload.offset(),
section.payload.length());
matching_sections.push_back(array_buffer);
}

View File

@ -510,7 +510,7 @@ class TruncatedUserString {
TruncatedUserString(const char* start, size_t len)
: start_(start), length_(std::min(kMaxLen, static_cast<int>(len))) {
if (len > static_cast<size_t>(kMaxLen)) {
base::Memcpy(buffer_, start, kMaxLen - 3);
memcpy(buffer_, start, kMaxLen - 3);
memset(buffer_ + kMaxLen - 3, '.', 3);
start_ = buffer_;
}

View File

@ -59,7 +59,7 @@ class Writer {
void WriteVector(const Vector<const byte> v) {
DCHECK_GE(current_size(), v.size());
if (v.size() > 0) {
base::Memcpy(current_location(), v.begin(), v.size());
memcpy(current_location(), v.begin(), v.size());
pos_ += v.size();
}
if (FLAG_trace_wasm_serialization) {
@ -383,7 +383,7 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
code_start = aligned_buffer.get();
}
#endif
base::Memcpy(code_start, code->instructions().begin(), code_size);
memcpy(code_start, code->instructions().begin(), code_size);
// Relocate the code.
int mask = RelocInfo::ModeMask(RelocInfo::WASM_CALL) |
RelocInfo::ModeMask(RelocInfo::WASM_STUB_CALL) |
@ -430,7 +430,7 @@ bool NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {
}
// If we copied to an aligned buffer, copy code into serialized buffer.
if (code_start != serialized_code_start) {
base::Memcpy(serialized_code_start, code_start, code_size);
memcpy(serialized_code_start, code_start, code_size);
}
total_written_code_ += code_size;
return true;
@ -742,8 +742,8 @@ DeserializationUnit NativeModuleDeserializer::ReadCode(int fn_index,
void NativeModuleDeserializer::CopyAndRelocate(
const DeserializationUnit& unit) {
base::Memcpy(unit.code->instructions().begin(), unit.src_code_buffer.begin(),
unit.src_code_buffer.size());
memcpy(unit.code->instructions().begin(), unit.src_code_buffer.begin(),
unit.src_code_buffer.size());
// Relocate the code.
int mask = RelocInfo::ModeMask(RelocInfo::WASM_CALL) |

View File

@ -49,8 +49,8 @@ class Simd128 {
#undef DEFINE_SIMD_TYPE_SPECIFIC_METHODS
explicit Simd128(byte* bytes) {
base::Memcpy(static_cast<void*>(val_), reinterpret_cast<void*>(bytes),
kSimd128Size);
memcpy(static_cast<void*>(val_), reinterpret_cast<void*>(bytes),
kSimd128Size);
}
const uint8_t* bytes() { return val_; }
@ -117,7 +117,7 @@ class WasmValue {
// value.
WasmValue(byte* raw_bytes, ValueType type) : type_(type), bit_pattern_{} {
DCHECK(type_.is_numeric());
base::Memcpy(bit_pattern_, raw_bytes, type.element_size_bytes());
memcpy(bit_pattern_, raw_bytes, type.element_size_bytes());
}
WasmValue(Handle<Object> ref, ValueType type) : type_(type), bit_pattern_{} {
@ -143,7 +143,7 @@ class WasmValue {
// Copy the underlying value to a byte pointer to a little endian value.
void CopyTo(byte* to) const {
DCHECK(type_.is_numeric());
base::Memcpy(to, bit_pattern_, type_.element_size_bytes());
memcpy(to, bit_pattern_, type_.element_size_bytes());
}
// Store the undelying value to a byte pointer, using the system's endianness.
@ -152,36 +152,36 @@ class WasmValue {
switch (type_.kind()) {
case kI8: {
int8_t value = to_i8();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kI16: {
int16_t value = to_i16();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kI32: {
int32_t value = to_i32();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kI64: {
int64_t value = to_i64();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kF32: {
float value = to_f32();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kF64: {
double value = to_f64();
base::Memcpy(static_cast<void*>(to), &value, sizeof(value));
memcpy(static_cast<void*>(to), &value, sizeof(value));
break;
}
case kS128:
base::Memcpy(static_cast<void*>(to), to_s128().bytes(), kSimd128Size);
memcpy(static_cast<void*>(to), to_s128().bytes(), kSimd128Size);
break;
case kRtt:
case kRttWithDepth:

View File

@ -36,7 +36,7 @@ void ZoneList<T>::AddAll(const Vector<const T>& other, Zone* zone) {
int result_length = length_ + length;
if (capacity_ < result_length) Resize(result_length, zone);
if (std::is_trivially_copyable<T>::value) {
base::Memcpy(&data_[length_], other.begin(), sizeof(T) * length);
memcpy(&data_[length_], other.begin(), sizeof(T) * length);
} else {
std::copy(other.begin(), other.end(), &data_[length_]);
}