Commit c092858a authored by paulgazz@chromium.org's avatar paulgazz@chromium.org

This patch uses single BytesInstruction Courgette ops to point to long...

This patch uses single BytesInstruction Courgette ops to point to long stretches of the binary file, instead of using one ByteInstruction op, which copies one byte at a time.  This reduces memory usages for very large files, since less data is copied, and fewer Instruction classes are constructed.

BUG=266068

Review URL: https://chromiumcodereview.appspot.com/22728002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217138 0039d316-1c4b-4281-b951-d872f2087c98
parent ea2ab47b
...@@ -422,6 +422,7 @@ EncodedProgram* AssemblyProgram::Encode() const { ...@@ -422,6 +422,7 @@ EncodedProgram* AssemblyProgram::Encode() const {
const uint8* byte_values = const uint8* byte_values =
static_cast<BytesInstruction*>(instruction)->byte_values(); static_cast<BytesInstruction*>(instruction)->byte_values();
uint32 len = static_cast<BytesInstruction*>(instruction)->len(); uint32 len = static_cast<BytesInstruction*>(instruction)->len();
if (!encoded->AddCopy(len, byte_values)) if (!encoded->AddCopy(len, byte_values))
return NULL; return NULL;
break; break;
......
...@@ -409,13 +409,13 @@ CheckBool DisassemblerElf32::ParseSimpleRegion( ...@@ -409,13 +409,13 @@ CheckBool DisassemblerElf32::ParseSimpleRegion(
const uint8* start = OffsetToPointer(start_file_offset); const uint8* start = OffsetToPointer(start_file_offset);
const uint8* end = OffsetToPointer(end_file_offset); const uint8* end = OffsetToPointer(end_file_offset);
const uint8* p = start; // Callers don't guarantee start < end
if (start >= end) return true;
while (p < end) { const ptrdiff_t len = end - start; // Works because vars are byte pointers
if (!program->EmitByteInstruction(*p))
if (!program->EmitBytesInstruction(start, len))
return false; return false;
++p;
}
return true; return true;
} }
......
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