Commit a23868fb authored by dslomov@chromium.org's avatar dslomov@chromium.org

Fix CopyBytes to accept size_t for num_bytes

BUG=

Review URL: https://codereview.chromium.org/13470008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14114 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent de17fa5b
......@@ -2183,7 +2183,8 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
ASSERT(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >=
desc.instr_size);
chunk->CommitArea(desc.instr_size);
CopyBytes(chunk->area_start(), desc.buffer, desc.instr_size);
CopyBytes(chunk->area_start(), desc.buffer,
static_cast<size_t>(desc.instr_size));
CPU::FlushICache(chunk->area_start(), desc.instr_size);
if (type == EAGER) {
......
......@@ -3884,7 +3884,7 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
Address new_addr = reinterpret_cast<HeapObject*>(result)->address();
// Copy header and instructions.
CopyBytes(new_addr, old_addr, static_cast<int>(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));
......@@ -3892,7 +3892,7 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
// Copy patched rinfo.
CopyBytes(new_code->relocation_start(),
reloc_info.start(),
reloc_info.length());
static_cast<size_t>(reloc_info.length()));
// Relocate the copy.
ASSERT(!isolate_->code_range()->exists() ||
......
......@@ -8849,12 +8849,13 @@ void Code::CopyFrom(const CodeDesc& desc) {
ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT);
// copy code
CopyBytes(instruction_start(), desc.buffer, desc.instr_size);
CopyBytes(instruction_start(), desc.buffer,
static_cast<size_t>(desc.instr_size));
// copy reloc info
CopyBytes(relocation_start(),
desc.buffer + desc.buffer_size - desc.reloc_size,
desc.reloc_size);
static_cast<size_t>(desc.reloc_size));
// unbox handles and relocate
intptr_t delta = instruction_start() - desc.buffer;
......
......@@ -151,20 +151,19 @@ inline void CopyWords(T* dst, T* src, int num_words) {
// Copies data from |src| to |dst|. The data spans must not overlap.
template <typename T>
inline void CopyBytes(T* dst, T* src, int num_bytes) {
inline void CopyBytes(T* dst, T* src, size_t num_bytes) {
STATIC_ASSERT(sizeof(T) == 1);
ASSERT(Min(dst, src) + num_bytes <= Max(dst, src));
ASSERT(num_bytes >= 0);
if (num_bytes == 0) return;
// 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;
if (num_bytes >= kBlockCopyLimit) {
if (num_bytes >= static_cast<size_t>(kBlockCopyLimit)) {
OS::MemCopy(dst, src, num_bytes);
} else {
int remaining = num_bytes;
size_t remaining = num_bytes;
do {
remaining--;
*dst++ = *src++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment