Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: src/liveedit.cc

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/list-inl.h ('k') | src/log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 if (new_buffer_size > kMaximalBufferSize) { 1428 if (new_buffer_size > kMaximalBufferSize) {
1429 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer"); 1429 V8::FatalProcessOutOfMemory("RelocInfoBuffer::GrowBuffer");
1430 } 1430 }
1431 1431
1432 // Set up new buffer. 1432 // Set up new buffer.
1433 byte* new_buffer = NewArray<byte>(new_buffer_size); 1433 byte* new_buffer = NewArray<byte>(new_buffer_size);
1434 1434
1435 // Copy the data. 1435 // Copy the data.
1436 int curently_used_size = 1436 int curently_used_size =
1437 static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos()); 1437 static_cast<int>(buffer_ + buffer_size_ - reloc_info_writer_.pos());
1438 memmove(new_buffer + new_buffer_size - curently_used_size, 1438 OS::MemMove(new_buffer + new_buffer_size - curently_used_size,
1439 reloc_info_writer_.pos(), curently_used_size); 1439 reloc_info_writer_.pos(), curently_used_size);
1440 1440
1441 reloc_info_writer_.Reposition( 1441 reloc_info_writer_.Reposition(
1442 new_buffer + new_buffer_size - curently_used_size, 1442 new_buffer + new_buffer_size - curently_used_size,
1443 reloc_info_writer_.last_pc()); 1443 reloc_info_writer_.last_pc());
1444 1444
1445 DeleteArray(buffer_); 1445 DeleteArray(buffer_);
1446 buffer_ = new_buffer; 1446 buffer_ = new_buffer;
1447 buffer_size_ = new_buffer_size; 1447 buffer_size_ = new_buffer_size;
1448 } 1448 }
1449 1449
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { 1481 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) {
1482 buffer_writer.Write(it.rinfo()); 1482 buffer_writer.Write(it.rinfo());
1483 } 1483 }
1484 } 1484 }
1485 } 1485 }
1486 1486
1487 Vector<byte> buffer = buffer_writer.GetResult(); 1487 Vector<byte> buffer = buffer_writer.GetResult();
1488 1488
1489 if (buffer.length() == code->relocation_size()) { 1489 if (buffer.length() == code->relocation_size()) {
1490 // Simply patch relocation area of code. 1490 // Simply patch relocation area of code.
1491 memcpy(code->relocation_start(), buffer.start(), buffer.length()); 1491 OS::MemCopy(code->relocation_start(), buffer.start(), buffer.length());
1492 return code; 1492 return code;
1493 } else { 1493 } else {
1494 // Relocation info section now has different size. We cannot simply 1494 // Relocation info section now has different size. We cannot simply
1495 // rewrite it inside code object. Instead we have to create a new 1495 // rewrite it inside code object. Instead we have to create a new
1496 // code object. 1496 // code object.
1497 Handle<Code> result(FACTORY->CopyCode(code, buffer)); 1497 Handle<Code> result(FACTORY->CopyCode(code, buffer));
1498 return result; 1498 return result;
1499 } 1499 }
1500 } 1500 }
1501 1501
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 Smi::cast(Memory::Object_at(padding_pointer))->value(); 1754 Smi::cast(Memory::Object_at(padding_pointer))->value();
1755 if (padding_counter * kPointerSize < shortage_bytes) { 1755 if (padding_counter * kPointerSize < shortage_bytes) {
1756 return "Not enough space for frame dropper frame " 1756 return "Not enough space for frame dropper frame "
1757 "(even with padding frame)"; 1757 "(even with padding frame)";
1758 } 1758 }
1759 Memory::Object_at(padding_pointer) = 1759 Memory::Object_at(padding_pointer) =
1760 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize); 1760 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize);
1761 1761
1762 StackFrame* pre_pre_frame = frames[top_frame_index - 2]; 1762 StackFrame* pre_pre_frame = frames[top_frame_index - 2];
1763 1763
1764 memmove(padding_start + kPointerSize - shortage_bytes, 1764 OS::MemMove(padding_start + kPointerSize - shortage_bytes,
1765 padding_start + kPointerSize, 1765 padding_start + kPointerSize,
1766 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize); 1766 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize);
1767 1767
1768 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes); 1768 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes);
1769 pre_pre_frame->SetCallerFp(pre_top_frame->fp()); 1769 pre_pre_frame->SetCallerFp(pre_top_frame->fp());
1770 unused_stack_top -= shortage_bytes; 1770 unused_stack_top -= shortage_bytes;
1771 1771
1772 STATIC_ASSERT(sizeof(Address) == kPointerSize); 1772 STATIC_ASSERT(sizeof(Address) == kPointerSize);
1773 top_frame_pc_address -= shortage_bytes / kPointerSize; 1773 top_frame_pc_address -= shortage_bytes / kPointerSize;
1774 } else { 1774 } else {
1775 return "Not enough space for frame dropper frame"; 1775 return "Not enough space for frame dropper frame";
1776 } 1776 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 2119
2120 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2120 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2121 return false; 2121 return false;
2122 } 2122 }
2123 2123
2124 #endif // ENABLE_DEBUGGER_SUPPORT 2124 #endif // ENABLE_DEBUGGER_SUPPORT
2125 2125
2126 2126
2127 2127
2128 } } // namespace v8::internal 2128 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/list-inl.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698