Use internal memcpy for CopyWords and when copying code.
R=jkummerow@chromium.org BUG=chromium:196330 Review URL: https://codereview.chromium.org/12970006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14020 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
5fcc52fcb9
commit
222d8d3d1c
@ -2130,7 +2130,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
|
||||
ASSERT(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >=
|
||||
desc.instr_size);
|
||||
chunk->CommitArea(desc.instr_size);
|
||||
memcpy(chunk->area_start(), desc.buffer, desc.instr_size);
|
||||
CopyBytes(chunk->area_start(), desc.buffer, desc.instr_size);
|
||||
CPU::FlushICache(chunk->area_start(), desc.instr_size);
|
||||
|
||||
if (type == EAGER) {
|
||||
|
@ -3888,13 +3888,15 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
|
||||
Address new_addr = reinterpret_cast<HeapObject*>(result)->address();
|
||||
|
||||
// Copy header and instructions.
|
||||
memcpy(new_addr, old_addr, relocation_offset);
|
||||
CopyBytes(new_addr, old_addr, relocation_offset);
|
||||
|
||||
Code* new_code = Code::cast(result);
|
||||
new_code->set_relocation_info(ByteArray::cast(reloc_info_array));
|
||||
|
||||
// Copy patched rinfo.
|
||||
memcpy(new_code->relocation_start(), reloc_info.start(), reloc_info.length());
|
||||
CopyBytes(new_code->relocation_start(),
|
||||
reloc_info.start(),
|
||||
reloc_info.length());
|
||||
|
||||
// Relocate the copy.
|
||||
ASSERT(!isolate_->code_range()->exists() ||
|
||||
|
@ -111,6 +111,7 @@ int WriteAsCFile(const char* filename, const char* varname,
|
||||
const char* str, int size, bool verbose = true);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Data structures
|
||||
|
||||
template <typename T>
|
||||
@ -120,6 +121,8 @@ inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms,
|
||||
reinterpret_cast<v8::internal::Handle<Object>*>(elms), length);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Memory
|
||||
|
||||
// Copies data from |src| to |dst|. The data spans must not overlap.
|
||||
@ -129,12 +132,13 @@ inline void CopyWords(T* dst, T* src, int num_words) {
|
||||
ASSERT(Min(dst, src) + num_words <= Max(dst, src));
|
||||
ASSERT(num_words > 0);
|
||||
|
||||
// Use block copying memcpy if the segment we're copying is
|
||||
// Use block copying OS::MemCopy if the segment we're copying is
|
||||
// enough to justify the extra call/setup overhead.
|
||||
static const int kBlockCopyLimit = 16;
|
||||
STATIC_ASSERT(kBlockCopyLimit * kPointerSize >= OS::kMinComplexMemCopy);
|
||||
|
||||
if (num_words >= kBlockCopyLimit) {
|
||||
memcpy(dst, src, num_words * kPointerSize);
|
||||
OS::MemCopy(dst, src, num_words * kPointerSize);
|
||||
} else {
|
||||
int remaining = num_words;
|
||||
do {
|
||||
@ -153,7 +157,7 @@ inline void CopyBytes(T* dst, T* src, int num_bytes) {
|
||||
ASSERT(num_bytes >= 0);
|
||||
if (num_bytes == 0) return;
|
||||
|
||||
// Use block copying memcpy if the segment we're copying is
|
||||
// Use block copying OS::MemCopy if the segment we're copying is
|
||||
// enough to justify the extra call/setup overhead.
|
||||
static const int kBlockCopyLimit = OS::kMinComplexMemCopy;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user