char* StrDup(const char* str) {
int length = StrLength(str);
char* result = NewArray<char>(length + 1);
- OS::MemCopy(result, str, length);
+ MemCopy(result, str, length);
result[length] = '\0';
return result;
}
int length = StrLength(str);
if (n < length) length = n;
char* result = NewArray<char>(length + 1);
- OS::MemCopy(result, str, length);
+ MemCopy(result, str, length);
result[length] = '\0';
return result;
}
// Write prefix.
char* ptr = buf.start();
- i::OS::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
+ i::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
ptr += prefix_len;
// Write real content.
ptr += str_len;
// Write postfix.
- i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
+ i::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
// Copy the buffer into a heap-allocated string and return it.
Local<String> result = v8::String::NewFromUtf8(
char* HandleScopeImplementer::ArchiveThread(char* storage) {
HandleScopeData* current = isolate_->handle_scope_data();
handle_scope_data_ = *current;
- OS::MemCopy(storage, this, sizeof(*this));
+ MemCopy(storage, this, sizeof(*this));
ResetAfterArchive();
current->Initialize();
char* HandleScopeImplementer::RestoreThread(char* storage) {
- OS::MemCopy(this, storage, sizeof(*this));
+ MemCopy(this, storage, sizeof(*this));
*isolate_->handle_scope_data() = handle_scope_data_;
return storage + ArchiveSpacePerThread();
}
static void DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) {
uint64_t i;
- OS::MemCopy(&i, &d, 8);
+ MemCopy(&i, &d, 8);
*lo = i & 0xffffffff;
*hi = i >> 32;
// Copy the data.
int pc_delta = desc.buffer - buffer_;
int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_);
- OS::MemMove(desc.buffer, buffer_, desc.instr_size);
- OS::MemMove(reloc_info_writer.pos() + rc_delta,
- reloc_info_writer.pos(), desc.reloc_size);
+ MemMove(desc.buffer, buffer_, desc.instr_size);
+ MemMove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(),
+ desc.reloc_size);
// Switch buffers.
DeleteArray(buffer_);
}
#if defined(V8_HOST_ARCH_ARM)
-OS::MemCopyUint8Function CreateMemCopyUint8Function(
- OS::MemCopyUint8Function stub) {
+MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) {
#if defined(USE_SIMULATOR)
return stub;
#else
CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size);
- return FUNCTION_CAST<OS::MemCopyUint8Function>(buffer);
+ return FUNCTION_CAST<MemCopyUint8Function>(buffer);
#endif
}
// Convert 8 to 16. The number of character to copy must be at least 8.
-OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
- OS::MemCopyUint16Uint8Function stub) {
+MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
+ MemCopyUint16Uint8Function stub) {
#if defined(USE_SIMULATOR)
return stub;
#else
CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size);
- return FUNCTION_CAST<OS::MemCopyUint16Uint8Function>(buffer);
+ return FUNCTION_CAST<MemCopyUint16Uint8Function>(buffer);
#endif
}
#endif
uint64_t imm = high16 << 48;
double d;
- OS::MemCopy(&d, &imm, 8);
+ MemCopy(&d, &imm, 8);
return d;
}
char* cached_line = cache_page->CachedData(offset & ~CachePage::kLineMask);
if (cache_hit) {
// Check that the data in memory matches the contents of the I-cache.
- CHECK_EQ(0, memcmp(reinterpret_cast<void*>(instr),
- cache_page->CachedData(offset),
- Instruction::kInstrSize));
+ CHECK_EQ(0,
+ memcmp(reinterpret_cast<void*>(instr),
+ cache_page->CachedData(offset), Instruction::kInstrSize));
} else {
// Cache miss. Load memory into the cache.
- OS::MemCopy(cached_line, line, CachePage::kLineLength);
+ MemCopy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
// 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])];
- OS::MemCopy(buffer, ®isters_[reg], 2 * sizeof(registers_[0]));
- OS::MemCopy(&dm_val, buffer, 2 * sizeof(registers_[0]));
+ MemCopy(buffer, ®isters_[reg], 2 * sizeof(registers_[0]));
+ MemCopy(&dm_val, buffer, 2 * sizeof(registers_[0]));
return(dm_val);
}
if (register_size == 2) ASSERT(reg_index < DwVfpRegister::NumRegisters());
char buffer[register_size * sizeof(vfp_registers_[0])];
- OS::MemCopy(buffer, &value, register_size * sizeof(vfp_registers_[0]));
- OS::MemCopy(&vfp_registers_[reg_index * register_size], buffer,
- register_size * sizeof(vfp_registers_[0]));
+ MemCopy(buffer, &value, register_size * sizeof(vfp_registers_[0]));
+ MemCopy(&vfp_registers_[reg_index * register_size], buffer,
+ register_size * sizeof(vfp_registers_[0]));
}
ReturnType value = 0;
char buffer[register_size * sizeof(vfp_registers_[0])];
- OS::MemCopy(buffer, &vfp_registers_[register_size * reg_index],
- register_size * sizeof(vfp_registers_[0]));
- OS::MemCopy(&value, buffer, register_size * sizeof(vfp_registers_[0]));
+ MemCopy(buffer, &vfp_registers_[register_size * reg_index],
+ register_size * sizeof(vfp_registers_[0]));
+ MemCopy(&value, buffer, register_size * sizeof(vfp_registers_[0]));
return value;
}
void Simulator::SetFpResult(const double& result) {
if (use_eabi_hardfloat()) {
char buffer[2 * sizeof(vfp_registers_[0])];
- OS::MemCopy(buffer, &result, sizeof(buffer));
+ MemCopy(buffer, &result, sizeof(buffer));
// Copy result to d0.
- OS::MemCopy(vfp_registers_, buffer, sizeof(buffer));
+ MemCopy(vfp_registers_, buffer, sizeof(buffer));
} else {
char buffer[2 * sizeof(registers_[0])];
- OS::MemCopy(buffer, &result, sizeof(buffer));
+ MemCopy(buffer, &result, sizeof(buffer));
// Copy result to r0 and r1.
- OS::MemCopy(registers_, buffer, sizeof(buffer));
+ MemCopy(registers_, buffer, sizeof(buffer));
}
}
ReadW(reinterpret_cast<int32_t>(address + 1), instr)
};
double d;
- OS::MemCopy(&d, data, 8);
+ MemCopy(&d, data, 8);
set_d_register_from_double(reg, d);
} else {
int32_t data[2];
double d = get_double_from_d_register(reg);
- OS::MemCopy(data, &d, 8);
+ MemCopy(data, &d, 8);
WriteW(reinterpret_cast<int32_t>(address), data[0], instr);
WriteW(reinterpret_cast<int32_t>(address + 1), data[1], instr);
}
int vd = instr->Bits(19, 16) | (instr->Bit(7) << 4);
double dd_value = get_double_from_d_register(vd);
int32_t data[2];
- OS::MemCopy(data, &dd_value, 8);
+ MemCopy(data, &dd_value, 8);
data[instr->Bit(21)] = get_register(instr->RtValue());
- OS::MemCopy(&dd_value, data, 8);
+ MemCopy(&dd_value, data, 8);
set_d_register_from_double(vd, dd_value);
} else if ((instr->VLValue() == 0x1) &&
(instr->VCValue() == 0x1) &&
int vn = instr->Bits(19, 16) | (instr->Bit(7) << 4);
double dn_value = get_double_from_d_register(vn);
int32_t data[2];
- OS::MemCopy(data, &dn_value, 8);
+ MemCopy(data, &dn_value, 8);
set_register(instr->RtValue(), data[instr->Bit(21)]);
} else if ((instr->VLValue() == 0x1) &&
(instr->VCValue() == 0x0) &&
if (instr->HasL()) {
int32_t data[2];
double d = get_double_from_d_register(vm);
- OS::MemCopy(data, &d, 8);
+ MemCopy(data, &d, 8);
set_register(rt, data[0]);
set_register(rn, data[1]);
} else {
int32_t data[] = { get_register(rt), get_register(rn) };
double d;
- OS::MemCopy(&d, data, 8);
+ MemCopy(&d, data, 8);
set_d_register_from_double(vm, d);
}
}
ReadW(address + 4, instr)
};
double val;
- OS::MemCopy(&val, data, 8);
+ MemCopy(&val, data, 8);
set_d_register_from_double(vd, val);
} else {
// Store double to memory: vstr.
int32_t data[2];
double val = get_double_from_d_register(vd);
- OS::MemCopy(data, &val, 8);
+ MemCopy(data, &val, 8);
WriteW(address, data[0], instr);
WriteW(address + 4, data[1], instr);
}
#include <string.h>
#include "atomicops.h"
-#include "platform.h"
+#include "utils.h"
// This file only makes sense with atomicops_internals_x86_gcc.h -- it
// depends on structs that are defined in that file. If atomicops.h
// Get vendor string (issue CPUID with eax = 0)
cpuid(eax, ebx, ecx, edx, 0);
char vendor[13];
- v8::internal::OS::MemCopy(vendor, &ebx, 4);
- v8::internal::OS::MemCopy(vendor + 4, &edx, 4);
- v8::internal::OS::MemCopy(vendor + 8, &ecx, 4);
+ v8::internal::MemCopy(vendor, &ebx, 4);
+ v8::internal::MemCopy(vendor + 4, &edx, 4);
+ v8::internal::MemCopy(vendor + 8, &ecx, 4);
vendor[12] = 0;
// get feature flags in ecx/edx, and family/model in eax
}
-static void MoveDoubleElements(FixedDoubleArray* dst,
- int dst_index,
- FixedDoubleArray* src,
- int src_index,
- int len) {
+static void MoveDoubleElements(FixedDoubleArray* dst, int dst_index,
+ FixedDoubleArray* src, int src_index, int len) {
if (len == 0) return;
- OS::MemMove(dst->data_start() + dst_index,
- src->data_start() + src_index,
- len * kDoubleSize);
+ MemMove(dst->data_start() + dst_index, src->data_start() + src_index,
+ len * kDoubleSize);
}
Address mantissa_ptr = reinterpret_cast<Address>(&x) + kIntSize;
#endif
// Copy least significant 32 bits of mantissa.
- OS::MemCopy(&result, mantissa_ptr, sizeof(result));
+ MemCopy(&result, mantissa_ptr, sizeof(result));
return negative ? ~result + 1 : result;
}
// Large number (outside uint32 range), Infinity or NaN.
char* Debug::ArchiveDebug(char* storage) {
char* to = storage;
- OS::MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
+ MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
ThreadInit();
return storage + ArchiveSpacePerThread();
}
char* Debug::RestoreDebug(char* storage) {
char* from = storage;
- OS::MemCopy(
- reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
+ MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
return storage + ArchiveSpacePerThread();
}
Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) {
int length = contents_.length();
Handle<ByteArray> result = factory->NewByteArray(length, TENURED);
- OS::MemCopy(
- result->GetDataStartAddress(), contents_.ToVector().start(), length);
+ MemCopy(result->GetDataStartAddress(), contents_.ToVector().start(), length);
return result;
}
char* StackGuard::ArchiveStackGuard(char* to) {
ExecutionAccess access(isolate_);
- OS::MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
+ MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
ThreadLocal blank;
// Set the stack limits using the old thread_local_.
char* StackGuard::RestoreStackGuard(char* from) {
ExecutionAccess access(isolate_);
- OS::MemCopy(
- reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
+ MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
isolate_->heap()->SetStackLimits();
return from + sizeof(ThreadLocal);
}
// make a copy so we can NUL-terminate flag name
size_t n = arg - *name;
CHECK(n < static_cast<size_t>(buffer_size)); // buffer is too small
- OS::MemCopy(buffer, *name, n);
+ MemCopy(buffer, *name, n);
buffer[n] = '\0';
*name = buffer;
// get the value
int FlagList::SetFlagsFromString(const char* str, int len) {
// make a 0-terminated copy of str
ScopedVector<char> copy0(len + 1);
- OS::MemCopy(copy0.start(), str, len);
+ MemCopy(copy0.start(), str, len);
copy0[len] = '\0';
// strip leading white space
#else
#error Unsupported target architecture.
#endif
- OS::MemCopy(header->ident, ident, 16);
+ MemCopy(header->ident, ident, 16);
header->type = 1;
#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
header->machine = 3;
entry->symfile_addr_ = reinterpret_cast<Address>(entry + 1);
entry->symfile_size_ = symfile_size;
- OS::MemCopy(entry->symfile_addr_, symfile_addr, symfile_size);
+ MemCopy(entry->symfile_addr_, symfile_addr, symfile_size);
entry->prev_ = entry->next_ = NULL;
ASSERT_EQ(size, answer->Size());
// Fill in the characters.
- OS::MemCopy(answer->address() + SeqOneByteString::kHeaderSize,
- str.start(), str.length());
+ MemCopy(answer->address() + SeqOneByteString::kHeaderSize, str.start(),
+ str.length());
return answer;
}
ASSERT_EQ(size, answer->Size());
// Fill in the characters.
- OS::MemCopy(answer->address() + SeqTwoByteString::kHeaderSize,
- str.start(), str.length() * kUC16Size);
+ MemCopy(answer->address() + SeqTwoByteString::kHeaderSize, str.start(),
+ str.length() * kUC16Size);
return answer;
}
*dst_slot++ = *src_slot++;
}
} else {
- OS::MemMove(dst, src, static_cast<size_t>(byte_size));
+ MemMove(dst, src, static_cast<size_t>(byte_size));
}
}
ASSERT(static_cast<size_t>(n) <= strlen(s));
const char* s_end = s + n;
while (s < s_end) {
- int s_chunk_size = Min(
- chunk_size_ - chunk_pos_, static_cast<int>(s_end - s));
+ int s_chunk_size =
+ Min(chunk_size_ - chunk_pos_, static_cast<int>(s_end - s));
ASSERT(s_chunk_size > 0);
- OS::MemCopy(chunk_.start() + chunk_pos_, s, s_chunk_size);
+ MemCopy(chunk_.start() + chunk_pos_, s, s_chunk_size);
s += s_chunk_size;
chunk_pos_ += s_chunk_size;
MaybeWriteChunk();
ASSERT(array->map() != fixed_cow_array_map());
Object** dst_objects = array->data_start() + dst_index;
- OS::MemMove(dst_objects,
- array->data_start() + src_index,
- len * kPointerSize);
+ MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize);
if (!InNewSpace(array)) {
for (int i = 0; i < len; i++) {
// TODO(hpayer): check store buffer for entries
int len) {
// Only works for ascii.
ASSERT(vector.length() == len);
- OS::MemCopy(chars, vector.start(), len);
+ MemCopy(chars, vector.start(), len);
}
static inline void WriteTwoByteData(Vector<const char> vector,
CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
#undef ADJUST_LAST_TIME_OBJECT_COUNT
- OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
- OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
+ MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
+ MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
ClearObjectStats();
}
int L = cursor_;
int R = size_ - cursor_;
- OS::MemMove(&tmp_entries[0], &entries_[0], L * sizeof(HCheckTableEntry));
- OS::MemMove(&entries_[0], &entries_[L], R * sizeof(HCheckTableEntry));
- OS::MemMove(&entries_[R], &tmp_entries[0], L * sizeof(HCheckTableEntry));
+ MemMove(&tmp_entries[0], &entries_[0], L * sizeof(HCheckTableEntry));
+ MemMove(&entries_[0], &entries_[L], R * sizeof(HCheckTableEntry));
+ MemMove(&entries_[R], &tmp_entries[0], L * sizeof(HCheckTableEntry));
}
cursor_ = size_; // Move cursor to end.
lists_(zone->NewArray<HInstructionMapListElement>(other->lists_size_)),
free_list_head_(other->free_list_head_),
side_effects_tracker_(other->side_effects_tracker_) {
- OS::MemCopy(
- array_, other->array_, array_size_ * sizeof(HInstructionMapListElement));
- OS::MemCopy(
- lists_, other->lists_, lists_size_ * sizeof(HInstructionMapListElement));
+ MemCopy(array_, other->array_,
+ array_size_ * sizeof(HInstructionMapListElement));
+ MemCopy(lists_, other->lists_,
+ lists_size_ * sizeof(HInstructionMapListElement));
}
lists_ = new_lists;
if (old_lists != NULL) {
- OS::MemCopy(
- lists_, old_lists, old_size * sizeof(HInstructionMapListElement));
+ MemCopy(lists_, old_lists, old_size * sizeof(HInstructionMapListElement));
}
for (int i = old_size; i < lists_size_; ++i) {
lists_[i].next = free_list_head_;
}
-HSideEffectMap& HSideEffectMap::operator= (const HSideEffectMap& other) {
+HSideEffectMap& HSideEffectMap::operator=(const HSideEffectMap& other) {
if (this != &other) {
- OS::MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize);
+ MemCopy(data_, other.data_, kNumberOfTrackedSideEffects * kPointerSize);
}
return *this;
}
// Copy the data.
int pc_delta = desc.buffer - buffer_;
int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_);
- OS::MemMove(desc.buffer, buffer_, desc.instr_size);
- OS::MemMove(rc_delta + reloc_info_writer.pos(),
- reloc_info_writer.pos(), desc.reloc_size);
+ MemMove(desc.buffer, buffer_, desc.instr_size);
+ MemMove(rc_delta + reloc_info_writer.pos(), reloc_info_writer.pos(),
+ desc.reloc_size);
// Switch buffers.
if (isolate()->assembler_spare_buffer() == NULL &&
};
-OS::MemMoveFunction CreateMemMoveFunction() {
+MemMoveFunction CreateMemMoveFunction() {
size_t actual_size;
// Allocate buffer in executable space.
byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
OS::ProtectCode(buffer, actual_size);
// TODO(jkummerow): It would be nice to register this code creation event
// with the PROFILE / GDBJIT system.
- return FUNCTION_CAST<OS::MemMoveFunction>(buffer);
+ return FUNCTION_CAST<MemMoveFunction>(buffer);
}
Factory* factory = isolate->factory();
Handle<ByteArray> new_reloc =
factory->NewByteArray(reloc_length + padding, TENURED);
- OS::MemCopy(new_reloc->GetDataStartAddress() + padding,
- code->relocation_info()->GetDataStartAddress(),
- reloc_length);
+ MemCopy(new_reloc->GetDataStartAddress() + padding,
+ code->relocation_info()->GetDataStartAddress(), reloc_length);
// Create a relocation writer to write the comments in the padding
// space. Use position 0 for everything to ensure short encoding.
RelocInfoWriter reloc_info_writer(
// Move the relocation info to the beginning of the byte array.
int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
- OS::MemMove(
- code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
+ MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
// The relocation info is in place, update the size.
reloc_info->set_length(new_reloc_size);
char* Isolate::ArchiveThread(char* to) {
- OS::MemCopy(to, reinterpret_cast<char*>(thread_local_top()),
- sizeof(ThreadLocalTop));
+ MemCopy(to, reinterpret_cast<char*>(thread_local_top()),
+ sizeof(ThreadLocalTop));
InitializeThreadLocal();
clear_pending_exception();
clear_pending_message();
char* Isolate::RestoreThread(char* from) {
- OS::MemCopy(reinterpret_cast<char*>(thread_local_top()), from,
- sizeof(ThreadLocalTop));
- // This might be just paranoia, but it seems to be needed in case a
- // thread_local_top_ is restored on a separate OS thread.
+ MemCopy(reinterpret_cast<char*>(thread_local_top()), from,
+ sizeof(ThreadLocalTop));
+// This might be just paranoia, but it seems to be needed in case a
+// thread_local_top_ is restored on a separate OS thread.
#ifdef USE_SIMULATOR
thread_local_top()->simulator_ = Simulator::current(this);
#endif
index);
if (result == RE_SUCCESS) {
// Copy capture results to the start of the registers array.
- OS::MemCopy(
- output, raw_output, number_of_capture_registers * sizeof(int32_t));
+ MemCopy(output, raw_output, number_of_capture_registers * sizeof(int32_t));
}
if (result == RE_EXCEPTION) {
ASSERT(!isolate->has_pending_exception());
void List<T, P>::Resize(int new_capacity, P alloc) {
ASSERT_LE(length_, new_capacity);
T* new_data = NewData(new_capacity, alloc);
- OS::MemCopy(new_data, data_, length_ * sizeof(T));
+ MemCopy(new_data, data_, length_ * sizeof(T));
List<T, P>::DeleteData(data_);
data_ = new_data;
capacity_ = new_capacity;
// issues when the stack allocated buffer goes out of scope.
size_t length = builder.position();
Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1);
- OS::MemCopy(copy.start(), builder.Finalize(), copy.length());
+ MemCopy(copy.start(), builder.Finalize(), copy.length());
masm()->RecordComment(copy.start());
}
// Copy the data.
int curently_used_size =
static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos());
- OS::MemMove(new_buffer + new_buffer_size - curently_used_size,
- reloc_info_writer_.pos(), curently_used_size);
+ MemMove(new_buffer + new_buffer_size - curently_used_size,
+ reloc_info_writer_.pos(), curently_used_size);
reloc_info_writer_.Reposition(
new_buffer + new_buffer_size - curently_used_size,
if (buffer.length() == code->relocation_size()) {
// Simply patch relocation area of code.
- OS::MemCopy(code->relocation_start(), buffer.start(), buffer.length());
+ MemCopy(code->relocation_start(), buffer.start(), buffer.length());
return code;
} else {
// Relocation info section now has different size. We cannot simply
StackFrame* pre_pre_frame = frames[top_frame_index - 2];
- OS::MemMove(padding_start + kPointerSize - shortage_bytes,
- padding_start + kPointerSize,
- Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize);
+ MemMove(padding_start + kPointerSize - shortage_bytes,
+ padding_start + kPointerSize,
+ Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize);
pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes);
pre_pre_frame->SetCallerFp(pre_top_frame->fp());
void AppendBytes(const char* bytes, int size) {
size = Min(size, kUtf8BufferSize - utf8_pos_);
- OS::MemCopy(utf8_buffer_ + utf8_pos_, bytes, size);
+ MemCopy(utf8_buffer_ + utf8_pos_, bytes, size);
utf8_pos_ += size;
}
// Open the low-level log file.
size_t len = strlen(name);
ScopedVector<char> ll_name(static_cast<int>(len + sizeof(kLogExt)));
- OS::MemCopy(ll_name.start(), name, len);
- OS::MemCopy(ll_name.start() + len, kLogExt, sizeof(kLogExt));
+ MemCopy(ll_name.start(), name, len);
+ MemCopy(ll_name.start() + len, kLogExt, sizeof(kLogExt));
ll_output_handle_ = OS::FOpen(ll_name.start(), OS::LogFileOpenMode);
setvbuf(ll_output_handle_, NULL, _IOFBF, kLogBufferSize);
void Assembler::DoubleAsTwoUInt32(double d, uint32_t* lo, uint32_t* hi) {
uint64_t i;
- OS::MemCopy(&i, &d, 8);
+ MemCopy(&i, &d, 8);
*lo = i & 0xffffffff;
*hi = i >> 32;
// Copy the data.
int pc_delta = desc.buffer - buffer_;
int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_);
- OS::MemMove(desc.buffer, buffer_, desc.instr_size);
- OS::MemMove(reloc_info_writer.pos() + rc_delta,
- reloc_info_writer.pos(), desc.reloc_size);
+ MemMove(desc.buffer, buffer_, desc.instr_size);
+ MemMove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(),
+ desc.reloc_size);
// Switch buffers.
DeleteArray(buffer_);
#if defined(V8_HOST_ARCH_MIPS)
-OS::MemCopyUint8Function CreateMemCopyUint8Function(
- OS::MemCopyUint8Function stub) {
+MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub) {
#if defined(USE_SIMULATOR)
return stub;
#else
CPU::FlushICache(buffer, actual_size);
OS::ProtectCode(buffer, actual_size);
- return FUNCTION_CAST<OS::MemCopyUint8Function>(buffer);
+ return FUNCTION_CAST<MemCopyUint8Function>(buffer);
#endif
}
#endif
Instruction::kInstrSize));
} else {
// Cache miss. Load memory into the cache.
- OS::MemCopy(cached_line, line, CachePage::kLineLength);
+ MemCopy(cached_line, line, CachePage::kLineLength);
*cache_valid_byte = CachePage::LINE_VALID;
}
}
// 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])];
- OS::MemCopy(buffer, ®isters_[reg], 2 * sizeof(registers_[0]));
- OS::MemCopy(&dm_val, buffer, 2 * sizeof(registers_[0]));
+ MemCopy(buffer, ®isters_[reg], 2 * sizeof(registers_[0]));
+ MemCopy(&dm_val, buffer, 2 * sizeof(registers_[0]));
return(dm_val);
}
// Registers a0 and a1 -> x.
reg_buffer[0] = get_register(a0);
reg_buffer[1] = get_register(a1);
- OS::MemCopy(x, buffer, sizeof(buffer));
+ MemCopy(x, buffer, sizeof(buffer));
// Registers a2 and a3 -> y.
reg_buffer[0] = get_register(a2);
reg_buffer[1] = get_register(a3);
- OS::MemCopy(y, buffer, sizeof(buffer));
+ MemCopy(y, buffer, sizeof(buffer));
// Register 2 -> z.
reg_buffer[0] = get_register(a2);
- OS::MemCopy(z, buffer, sizeof(*z));
+ MemCopy(z, buffer, sizeof(*z));
}
}
} else {
char buffer[2 * sizeof(registers_[0])];
int32_t* reg_buffer = reinterpret_cast<int32_t*>(buffer);
- OS::MemCopy(buffer, &result, sizeof(buffer));
+ MemCopy(buffer, &result, sizeof(buffer));
// Copy result to v0 and v1.
set_register(v0, reg_buffer[0]);
set_register(v1, reg_buffer[1]);
} else {
int buffer[2];
ASSERT(sizeof(buffer[0]) * 2 == sizeof(d0));
- OS::MemCopy(buffer, &d0, sizeof(d0));
+ MemCopy(buffer, &d0, sizeof(d0));
set_dw_register(a0, buffer);
- OS::MemCopy(buffer, &d1, sizeof(d1));
+ MemCopy(buffer, &d1, sizeof(d1));
set_dw_register(a2, buffer);
}
CallInternal(entry);
if (previous_length != 0) {
uint8_t* previous_array =
previous->serialized_data()->GetDataStartAddress();
- OS::MemCopy(array, previous_array, previous_length);
+ MemCopy(array, previous_array, previous_length);
array += previous_length;
}
ASSERT(reinterpret_cast<uintptr_t>(array) % sizeof(uintptr_t) == 0);
}
-#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
-static void MemMoveWrapper(void* dest, const void* src, size_t size) {
- memmove(dest, src, size);
-}
-
-
-// Initialize to library version so we can call this at any time during startup.
-static OS::MemMoveFunction memmove_function = &MemMoveWrapper;
-
-// Defined in codegen-ia32.cc.
-OS::MemMoveFunction CreateMemMoveFunction();
-
-// Copy memory area. No restrictions.
-void OS::MemMove(void* dest, const void* src, size_t size) {
- if (size == 0) return;
- // Note: here we rely on dependent reads being ordered. This is true
- // on all architectures we currently support.
- (*memmove_function)(dest, src, size);
-}
-
-#elif defined(V8_HOST_ARCH_ARM)
-void OS::MemCopyUint16Uint8Wrapper(uint16_t* dest,
- const uint8_t* src,
- size_t chars) {
- uint16_t *limit = dest + chars;
- while (dest < limit) {
- *dest++ = static_cast<uint16_t>(*src++);
- }
-}
-
-
-OS::MemCopyUint8Function OS::memcopy_uint8_function = &OS::MemCopyUint8Wrapper;
-OS::MemCopyUint16Uint8Function OS::memcopy_uint16_uint8_function =
- &OS::MemCopyUint16Uint8Wrapper;
-// Defined in codegen-arm.cc.
-OS::MemCopyUint8Function CreateMemCopyUint8Function(
- OS::MemCopyUint8Function stub);
-OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
- OS::MemCopyUint16Uint8Function stub);
-
-#elif defined(V8_HOST_ARCH_MIPS)
-OS::MemCopyUint8Function OS::memcopy_uint8_function = &OS::MemCopyUint8Wrapper;
-// Defined in codegen-mips.cc.
-OS::MemCopyUint8Function CreateMemCopyUint8Function(
- OS::MemCopyUint8Function stub);
-#endif
-
-
-void OS::PostSetUp() {
-#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
- OS::MemMoveFunction generated_memmove = CreateMemMoveFunction();
- if (generated_memmove != NULL) {
- memmove_function = generated_memmove;
- }
-#elif defined(V8_HOST_ARCH_ARM)
- OS::memcopy_uint8_function =
- CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper);
- OS::memcopy_uint16_uint8_function =
- CreateMemCopyUint16Uint8Function(&OS::MemCopyUint16Uint8Wrapper);
-#elif defined(V8_HOST_ARCH_MIPS)
- OS::memcopy_uint8_function =
- CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper);
-#endif
-}
-
-
// ----------------------------------------------------------------------------
// POSIX string support.
//
}
-#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
-static void MemMoveWrapper(void* dest, const void* src, size_t size) {
- memmove(dest, src, size);
-}
-
-
-// Initialize to library version so we can call this at any time during startup.
-static OS::MemMoveFunction memmove_function = &MemMoveWrapper;
-
-// Defined in codegen-ia32.cc.
-OS::MemMoveFunction CreateMemMoveFunction();
-
-// Copy memory area to disjoint memory area.
-void OS::MemMove(void* dest, const void* src, size_t size) {
- if (size == 0) return;
- // Note: here we rely on dependent reads being ordered. This is true
- // on all architectures we currently support.
- (*memmove_function)(dest, src, size);
-}
-
-#endif // V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
-
-
class TimezoneCache {
public:
TimezoneCache() : initialized_(false) { }
}
-void OS::PostSetUp() {
-#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
- OS::MemMoveFunction generated_memmove = CreateMemMoveFunction();
- if (generated_memmove != NULL) {
- memmove_function = generated_memmove;
- }
-#endif
-}
-
-
// Returns the accumulated user time for thread.
int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) {
FILETIME dummy;
if (file_mapping == NULL) return NULL;
// Map a view of the file into memory
void* memory = MapViewOfFile(file_mapping, FILE_MAP_ALL_ACCESS, 0, 0, size);
- if (memory) OS::MemMove(memory, initial, size);
+ if (memory) MemMove(memory, initial, size);
return new Win32MemoryMappedFile(file, file_mapping, memory, size);
}
class OS {
public:
- // Initializes the platform OS support that depend on CPU features. This is
- // called after CPU initialization.
- static void PostSetUp();
-
// Returns the accumulated user time for thread. This routine
// can be used for profiling. The implementation should
// strive for high-precision timer resolution, preferable
// the platform doesn't care. Guaranteed to be a power of two.
static int ActivationFrameAlignment();
-#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87)
- // Limit below which the extra overhead of the MemCopy function is likely
- // to outweigh the benefits of faster copying.
- static const int kMinComplexMemCopy = 64;
-
- // Copy memory area. No restrictions.
- static void MemMove(void* dest, const void* src, size_t size);
- typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size);
-
- // Keep the distinction of "move" vs. "copy" for the benefit of other
- // architectures.
- static void MemCopy(void* dest, const void* src, size_t size) {
- MemMove(dest, src, size);
- }
-#elif defined(V8_HOST_ARCH_ARM)
- typedef void (*MemCopyUint8Function)(uint8_t* dest,
- const uint8_t* src,
- size_t size);
- static MemCopyUint8Function memcopy_uint8_function;
- static void MemCopyUint8Wrapper(uint8_t* dest,
- const uint8_t* src,
- size_t chars) {
- memcpy(dest, src, chars);
- }
- // For values < 16, the assembler function is slower than the inlined C code.
- static const int kMinComplexMemCopy = 16;
- static void MemCopy(void* dest, const void* src, size_t size) {
- (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
- reinterpret_cast<const uint8_t*>(src),
- size);
- }
- static void MemMove(void* dest, const void* src, size_t size) {
- memmove(dest, src, size);
- }
-
- typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest,
- const uint8_t* src,
- size_t size);
- static MemCopyUint16Uint8Function memcopy_uint16_uint8_function;
- static void MemCopyUint16Uint8Wrapper(uint16_t* dest,
- const uint8_t* src,
- size_t chars);
- // For values < 12, the assembler function is slower than the inlined C code.
- static const int kMinComplexConvertMemCopy = 12;
- static void MemCopyUint16Uint8(uint16_t* dest,
- const uint8_t* src,
- size_t size) {
- (*memcopy_uint16_uint8_function)(dest, src, size);
- }
-#elif defined(V8_HOST_ARCH_MIPS)
- typedef void (*MemCopyUint8Function)(uint8_t* dest,
- const uint8_t* src,
- size_t size);
- static MemCopyUint8Function memcopy_uint8_function;
- static void MemCopyUint8Wrapper(uint8_t* dest,
- const uint8_t* src,
- size_t chars) {
- memcpy(dest, src, chars);
- }
- // For values < 16, the assembler function is slower than the inlined C code.
- static const int kMinComplexMemCopy = 16;
- static void MemCopy(void* dest, const void* src, size_t size) {
- (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
- reinterpret_cast<const uint8_t*>(src),
- size);
- }
- static void MemMove(void* dest, const void* src, size_t size) {
- memmove(dest, src, size);
- }
-#else
- // Copy memory area to disjoint memory area.
- static void MemCopy(void* dest, const void* src, size_t size) {
- memcpy(dest, src, size);
- }
- static void MemMove(void* dest, const void* src, size_t size) {
- memmove(dest, src, size);
- }
- static const int kMinComplexMemCopy = 16 * kPointerSize;
-#endif // V8_TARGET_ARCH_IA32
-
static int GetCurrentProcessId();
private:
int total_size = PreparseDataConstants::kHeaderSize + function_size;
Vector<unsigned> data = Vector<unsigned>::New(total_size);
preamble_[PreparseDataConstants::kFunctionsSizeOffset] = function_size;
- OS::MemCopy(data.start(), preamble_, sizeof(preamble_));
+ MemCopy(data.start(), preamble_, sizeof(preamble_));
if (function_size > 0) {
function_store_.WriteTo(data.SubVector(PreparseDataConstants::kHeaderSize,
total_size));
const int slack = 32;
int new_size = size_ + (size_ >> 1) + slack;
char* new_output = NewArray<char>(new_size);
- OS::MemCopy(new_output, output_, pos_);
+ MemCopy(new_output, output_, pos_);
DeleteArray(output_);
output_ = new_output;
size_ = new_size;
void RegExpMacroAssemblerIrregexp::Copy(Address a) {
- OS::MemCopy(a, buffer_.start(), length());
+ MemCopy(a, buffer_.start(), length());
}
Vector<byte> old_buffer = buffer_;
buffer_ = Vector<byte>::New(old_buffer.length() * 2);
own_buffer_ = true;
- OS::MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length());
+ MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length());
if (old_buffer_was_our_own) {
old_buffer.Dispose();
}
char* RegExpStack::ArchiveStack(char* to) {
size_t size = sizeof(thread_local_);
- OS::MemCopy(reinterpret_cast<void*>(to), &thread_local_, size);
+ MemCopy(reinterpret_cast<void*>(to), &thread_local_, size);
thread_local_ = ThreadLocal();
return to + size;
}
char* RegExpStack::RestoreStack(char* from) {
size_t size = sizeof(thread_local_);
- OS::MemCopy(&thread_local_, reinterpret_cast<void*>(from), size);
+ MemCopy(&thread_local_, reinterpret_cast<void*>(from), size);
return from + size;
}
Address new_memory = NewArray<byte>(static_cast<int>(size));
if (thread_local_.memory_size_ > 0) {
// Copy original memory into top of new memory.
- OS::MemCopy(
- reinterpret_cast<void*>(
- new_memory + size - thread_local_.memory_size_),
- reinterpret_cast<void*>(thread_local_.memory_),
- thread_local_.memory_size_);
+ MemCopy(reinterpret_cast<void*>(new_memory + size -
+ thread_local_.memory_size_),
+ reinterpret_cast<void*>(thread_local_.memory_),
+ thread_local_.memory_size_);
DeleteArray(thread_local_.memory_);
}
thread_local_.memory_ = new_memory;
void ExpandBuffer() {
Vector<byte> new_store = Vector<byte>::New(NewCapacity(kInitialCapacity));
- OS::MemCopy(new_store.start(), backing_store_.start(), position_);
+ MemCopy(new_store.start(), backing_store_.start(), position_);
backing_store_.Dispose();
backing_store_ = new_store;
}
static Code* CloneCodeObject(HeapObject* code) {
Address copy = new byte[code->Size()];
- OS::MemCopy(copy, code->address(), code->Size());
+ MemCopy(copy, code->address(), code->Size());
return Code::cast(HeapObject::FromAddress(copy));
}
void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) {
- OS::MemCopy(to, data_ + position_, number_of_bytes);
+ MemCopy(to, data_ + position_, number_of_bytes);
position_ += number_of_bytes;
}
SmartArrayPointer<const char> StringStream::ToCString() const {
char* str = NewArray<char>(length_ + 1);
- OS::MemCopy(str, buffer_, length_);
+ MemCopy(str, buffer_, length_);
str[length_] = '\0';
return SmartArrayPointer<const char>(str);
}
if (new_space == NULL) {
return space_;
}
- OS::MemCopy(new_space, space_, *bytes);
+ MemCopy(new_space, space_, *bytes);
*bytes = new_bytes;
DeleteArray(space_);
space_ = new_space;
#include "unicode.h"
#include "checks.h"
-#include "platform.h"
+#include "utils.h"
namespace unibrow {
// memcpy everything in buffer.
unsigned buffer_length =
last_byte_of_buffer_unused_ ? kBufferSize - 1 : kBufferSize;
- unsigned memcpy_length = length <= buffer_length ? length : buffer_length;
- v8::internal::OS::MemCopy(data, buffer_, memcpy_length*sizeof(uint16_t));
+ unsigned memcpy_length = length <= buffer_length ? length : buffer_length;
+ v8::internal::MemCopy(data, buffer_, memcpy_length * sizeof(uint16_t));
if (length <= buffer_length) return length;
ASSERT(unbuffered_start_ != NULL);
// Copy the rest the slow way.
void SimpleStringBuilder::AddSubstring(const char* s, int n) {
ASSERT(!is_finalized() && position_ + n <= buffer_.length());
ASSERT(static_cast<size_t>(n) <= strlen(s));
- OS::MemCopy(&buffer_[position_], s, n * kCharSize);
+ MemCopy(&buffer_[position_], s, n * kCharSize);
position_ += n;
}
char* new_result = NewArray<char>(new_len);
// Copy the existing input into the new array and set the new
// array as the result.
- OS::MemCopy(new_result, result, offset * kCharSize);
+ MemCopy(new_result, result, offset * kCharSize);
DeleteArray(result);
result = new_result;
}
// Copy the newly read line into the result.
- OS::MemCopy(result + offset, line_buf, len * kCharSize);
+ MemCopy(result + offset, line_buf, len * kCharSize);
offset += len;
}
ASSERT(result != NULL);
}
+#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
+static void MemMoveWrapper(void* dest, const void* src, size_t size) {
+ memmove(dest, src, size);
+}
+
+
+// Initialize to library version so we can call this at any time during startup.
+static MemMoveFunction memmove_function = &MemMoveWrapper;
+
+// Defined in codegen-ia32.cc.
+MemMoveFunction CreateMemMoveFunction();
+
+// Copy memory area to disjoint memory area.
+void MemMove(void* dest, const void* src, size_t size) {
+ if (size == 0) return;
+ // Note: here we rely on dependent reads being ordered. This is true
+ // on all architectures we currently support.
+ (*memmove_function)(dest, src, size);
+}
+
+#elif V8_OS_POSIX && V8_HOST_ARCH_ARM
+void MemCopyUint16Uint8Wrapper(uint16_t* dest, const uint8_t* src,
+ size_t chars) {
+ uint16_t* limit = dest + chars;
+ while (dest < limit) {
+ *dest++ = static_cast<uint16_t>(*src++);
+ }
+}
+
+
+MemCopyUint8Function memcopy_uint8_function = &MemCopyUint8Wrapper;
+MemCopyUint16Uint8Function memcopy_uint16_uint8_function =
+ &MemCopyUint16Uint8Wrapper;
+// Defined in codegen-arm.cc.
+MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub);
+MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function(
+ MemCopyUint16Uint8Function stub);
+
+#elif V8_OS_POSIX && V8_HOST_ARCH_MIPS
+MemCopyUint8Function memcopy_uint8_function = &MemCopyUint8Wrapper;
+// Defined in codegen-mips.cc.
+MemCopyUint8Function CreateMemCopyUint8Function(MemCopyUint8Function stub);
+#endif
+
+
+void init_memcopy_functions() {
+#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87
+ MemMoveFunction generated_memmove = CreateMemMoveFunction();
+ if (generated_memmove != NULL) {
+ memmove_function = generated_memmove;
+ }
+#elif V8_OS_POSIX && V8_HOST_ARCH_ARM
+ memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper);
+ memcopy_uint16_uint8_function =
+ CreateMemCopyUint16Uint8Function(&MemCopyUint16Uint8Wrapper);
+#elif V8_OS_POSIX && V8_HOST_ARCH_MIPS
+ memcopy_uint8_function = CreateMemCopyUint8Function(&MemCopyUint8Wrapper);
+#endif
+}
+
+
} } // namespace v8::internal
}
+// ----------------------------------------------------------------------------
+// Generated memcpy/memmove
+
+// Initializes the codegen support that depends on CPU features. This is
+// called after CPU initialization.
+void init_memcopy_functions();
+
+#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87)
+// Limit below which the extra overhead of the MemCopy function is likely
+// to outweigh the benefits of faster copying.
+const int kMinComplexMemCopy = 64;
+
+// Copy memory area. No restrictions.
+void MemMove(void* dest, const void* src, size_t size);
+typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size);
+
+// Keep the distinction of "move" vs. "copy" for the benefit of other
+// architectures.
+V8_INLINE void MemCopy(void* dest, const void* src, size_t size) {
+ MemMove(dest, src, size);
+}
+#elif defined(V8_HOST_ARCH_ARM)
+typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src,
+ size_t size);
+MemCopyUint8Function memcopy_uint8_function;
+void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src, size_t chars) {
+ memcpy(dest, src, chars);
+}
+// For values < 16, the assembler function is slower than the inlined C code.
+const int kMinComplexMemCopy = 16;
+V8_INLINE void MemCopy(void* dest, const void* src, size_t size) {
+ (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
+ reinterpret_cast<const uint8_t*>(src), size);
+}
+V8_INLINE void MemMove(void* dest, const void* src, size_t size) {
+ memmove(dest, src, size);
+}
+
+typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest, const uint8_t* src,
+ size_t size);
+MemCopyUint16Uint8Function memcopy_uint16_uint8_function;
+void MemCopyUint16Uint8Wrapper(uint16_t* dest, const uint8_t* src,
+ size_t chars);
+// For values < 12, the assembler function is slower than the inlined C code.
+const int kMinComplexConvertMemCopy = 12;
+V8_INLINE void MemCopyUint16Uint8(uint16_t* dest, const uint8_t* src,
+ size_t size) {
+ (*memcopy_uint16_uint8_function)(dest, src, size);
+}
+#elif defined(V8_HOST_ARCH_MIPS)
+typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src,
+ size_t size);
+MemCopyUint8Function memcopy_uint8_function;
+V8_INLINE void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src,
+ size_t chars) {
+ memcpy(dest, src, chars);
+}
+// For values < 16, the assembler function is slower than the inlined C code.
+const int kMinComplexMemCopy = 16;
+V8_INLINE void MemCopy(void* dest, const void* src, size_t size) {
+ (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest),
+ reinterpret_cast<const uint8_t*>(src), size);
+}
+V8_INLINE void MemMove(void* dest, const void* src, size_t size) {
+ memmove(dest, src, size);
+}
+#else
+// Copy memory area to disjoint memory area.
+V8_INLINE void MemCopy(void* dest, const void* src, size_t size) {
+ memcpy(dest, src, size);
+}
+V8_INLINE void MemMove(void* dest, const void* src, size_t size) {
+ memmove(dest, src, size);
+}
+const int kMinComplexMemCopy = 16 * kPointerSize;
+#endif // V8_TARGET_ARCH_IA32
+
+
// ----------------------------------------------------------------------------
// Miscellaneous
// When copying, make underlying Vector to reference our buffer.
EmbeddedVector(const EmbeddedVector& rhs)
: Vector<T>(rhs) {
- OS::MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
+ MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
set_start(buffer_);
}
EmbeddedVector& operator=(const EmbeddedVector& rhs) {
if (this == &rhs) return *this;
Vector<T>::operator=(rhs);
- OS::MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
+ MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
this->set_start(buffer_);
return *this;
}
// Max(dst, const_cast<T*>(src)));
ASSERT(num_words > 0);
- // Use block copying OS::MemCopy if the segment we're copying is
+ // Use block copying MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
static const size_t kBlockCopyLimit = 16;
*dst++ = *src++;
} while (num_words > 0);
} else {
- OS::MemCopy(dst, src, num_words * kPointerSize);
+ MemCopy(dst, src, num_words * kPointerSize);
}
}
STATIC_ASSERT(sizeof(T) == kPointerSize);
ASSERT(num_words > 0);
- // Use block copying OS::MemCopy if the segment we're copying is
+ // Use block copying MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
static const size_t kBlockCopyLimit = 16;
*dst++ = *src++;
} while (num_words > 0);
} else {
- OS::MemMove(dst, src, num_words * kPointerSize);
+ MemMove(dst, src, num_words * kPointerSize);
}
}
Max(dst, const_cast<T*>(src)));
if (num_bytes == 0) return;
- // Use block copying OS::MemCopy if the segment we're copying is
+ // Use block copying MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
- static const int kBlockCopyLimit = OS::kMinComplexMemCopy;
+ static const int kBlockCopyLimit = kMinComplexMemCopy;
if (num_bytes < static_cast<size_t>(kBlockCopyLimit)) {
do {
*dst++ = *src++;
} while (num_bytes > 0);
} else {
- OS::MemCopy(dst, src, num_bytes);
+ MemCopy(dst, src, num_bytes);
}
}
sinkchar* limit = dest + chars;
#ifdef V8_HOST_CAN_READ_UNALIGNED
if (sizeof(*dest) == sizeof(*src)) {
- if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) {
- OS::MemCopy(dest, src, chars * sizeof(*dest));
+ if (chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest))) {
+ MemCopy(dest, src, chars * sizeof(*dest));
return;
}
// Number of characters in a uintptr_t.
memcpy(dest, src, 15);
break;
default:
- OS::MemCopy(dest, src, chars);
+ MemCopy(dest, src, chars);
break;
}
}
void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, int chars) {
- if (chars >= OS::kMinComplexConvertMemCopy) {
- OS::MemCopyUint16Uint8(dest, src, chars);
+ if (chars >= kMinComplexConvertMemCopy) {
+ MemCopyUint16Uint8(dest, src, chars);
} else {
- OS::MemCopyUint16Uint8Wrapper(dest, src, chars);
+ MemCopyUint16Uint8Wrapper(dest, src, chars);
}
}
memcpy(dest, src, 14);
break;
default:
- OS::MemCopy(dest, src, chars * sizeof(*dest));
+ MemCopy(dest, src, chars * sizeof(*dest));
break;
}
}
#elif defined(V8_HOST_ARCH_MIPS)
void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, int chars) {
- if (chars < OS::kMinComplexMemCopy) {
+ if (chars < kMinComplexMemCopy) {
memcpy(dest, src, chars);
} else {
- OS::MemCopy(dest, src, chars);
+ MemCopy(dest, src, chars);
}
}
void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, int chars) {
- if (chars < OS::kMinComplexMemCopy) {
+ if (chars < kMinComplexMemCopy) {
memcpy(dest, src, chars * sizeof(*dest));
} else {
- OS::MemCopy(dest, src, chars * sizeof(*dest));
+ MemCopy(dest, src, chars * sizeof(*dest));
}
}
#endif
#endif
Sampler::SetUp();
CpuFeatures::Probe(false);
- OS::PostSetUp();
+ init_memcopy_functions();
// The custom exp implementation needs 16KB of lookup data; initialize it
// on demand.
init_fast_sqrt_function();
intptr_t pc_delta = desc.buffer - buffer_;
intptr_t rc_delta = (desc.buffer + desc.buffer_size) -
(buffer_ + buffer_size_);
- OS::MemMove(desc.buffer, buffer_, desc.instr_size);
- OS::MemMove(rc_delta + reloc_info_writer.pos(),
- reloc_info_writer.pos(), desc.reloc_size);
+ MemMove(desc.buffer, buffer_, desc.instr_size);
+ MemMove(rc_delta + reloc_info_writer.pos(), reloc_info_writer.pos(),
+ desc.reloc_size);
// Switch buffers.
if (isolate() != NULL &&
// Copy the data.
int pc_delta = desc.buffer - buffer_;
int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_);
- OS::MemMove(desc.buffer, buffer_, desc.instr_size);
- OS::MemMove(rc_delta + reloc_info_writer.pos(),
- reloc_info_writer.pos(), desc.reloc_size);
+ MemMove(desc.buffer, buffer_, desc.instr_size);
+ MemMove(rc_delta + reloc_info_writer.pos(), reloc_info_writer.pos(),
+ desc.reloc_size);
// Switch buffers.
if (isolate()->assembler_spare_buffer() == NULL &&
};
-OS::MemMoveFunction CreateMemMoveFunction() {
+MemMoveFunction CreateMemMoveFunction() {
size_t actual_size;
// Allocate buffer in executable space.
byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
OS::ProtectCode(buffer, actual_size);
// TODO(jkummerow): It would be nice to register this code creation event
// with the PROFILE / GDBJIT system.
- return FUNCTION_CAST<OS::MemMoveFunction>(buffer);
+ return FUNCTION_CAST<MemMoveFunction>(buffer);
}
Factory* factory = isolate->factory();
Handle<ByteArray> new_reloc =
factory->NewByteArray(reloc_length + padding, TENURED);
- OS::MemCopy(new_reloc->GetDataStartAddress() + padding,
- code->relocation_info()->GetDataStartAddress(),
- reloc_length);
+ MemCopy(new_reloc->GetDataStartAddress() + padding,
+ code->relocation_info()->GetDataStartAddress(), reloc_length);
// Create a relocation writer to write the comments in the padding
// space. Use position 0 for everything to ensure short encoding.
RelocInfoWriter reloc_info_writer(
// Move the relocation info to the beginning of the byte array.
int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
- OS::MemMove(
- code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
+ MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
// The relocation info is in place, update the size.
reloc_info->set_length(new_reloc_size);
// Serialize.
const v8::ScriptCompiler::CachedData* cd = source.GetCachedData();
char* serialized_data = i::NewArray<char>(cd->length);
- i::OS::MemCopy(serialized_data, cd->data, cd->length);
+ i::MemCopy(serialized_data, cd->data, cd->length);
// Deserialize.
i::ScriptData* deserialized = i::ScriptData::New(serialized_data, cd->length);
static double DoubleFromBits(uint64_t value) {
double target;
- i::OS::MemCopy(&target, &value, sizeof(target));
+ i::MemCopy(&target, &value, sizeof(target));
return target;
}
static uint64_t DoubleToBits(double value) {
uint64_t target;
- i::OS::MemCopy(&target, &value, sizeof(target));
+ i::MemCopy(&target, &value, sizeof(target));
return target;
}
for (int i = 0; i < max_rows; ++i) {
if (i > 0)
buffer[i - 1] = '\n';
- OS::MemCopy(&buffer[i], function_f, sizeof(function_f) - 1);
+ MemCopy(&buffer[i], function_f, sizeof(function_f) - 1);
v8::Handle<v8::String> script_body =
v8::String::NewFromUtf8(CcTest::isolate(), buffer.start());
v8::Script::Compile(script_body, &origin)->Run();
if (abort_countdown_ == 0) return kAbort;
CHECK_GT(chars_written, 0);
i::Vector<char> chunk = buffer_.AddBlock(chars_written, '\0');
- i::OS::MemCopy(chunk.start(), buffer, chars_written);
+ i::MemCopy(chunk.start(), buffer, chars_written);
return kContinue;
}
virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) {
// Adding characters will make keyword matching fail.
static const char chars_to_append[] = { 'z', '0', '_' };
for (int j = 0; j < static_cast<int>(ARRAY_SIZE(chars_to_append)); ++j) {
- i::OS::MemMove(buffer, keyword, length);
+ i::MemMove(buffer, keyword, length);
buffer[length] = chars_to_append[j];
i::Utf8ToUtf16CharacterStream stream(buffer, length + 1);
i::Scanner scanner(&unicode_cache);
}
// Replacing characters will make keyword matching fail.
{
- i::OS::MemMove(buffer, keyword, length);
+ i::MemMove(buffer, keyword, length);
buffer[length - 1] = '_';
i::Utf8ToUtf16CharacterStream stream(buffer, length);
i::Scanner scanner(&unicode_cache);
area1[i] = i & 0xFF;
area2[i] = i & 0xFF;
}
- OS::MemMove(area1 + dest_offset, area1 + src_offset, length);
+ MemMove(area1 + dest_offset, area1 + src_offset, length);
memmove(area2 + dest_offset, area2 + src_offset, length);
if (memcmp(area1, area2, kAreaSize) != 0) {
- printf("OS::MemMove(): src_offset: %d, dest_offset: %d, length: %d\n",
+ printf("MemMove(): src_offset: %d, dest_offset: %d, length: %d\n",
src_offset, dest_offset, length);
for (int i = 0; i < kAreaSize; i++) {
if (area1[i] == area2[i]) continue;
- printf("diff at offset %d (%p): is %d, should be %d\n",
- i, reinterpret_cast<void*>(area1 + i), area1[i], area2[i]);
+ printf("diff at offset %d (%p): is %d, should be %d\n", i,
+ reinterpret_cast<void*>(area1 + i), area1[i], area2[i]);
}
CHECK(false);
}