Commit 47e1cc46 authored by danno's avatar danno Committed by Commit bot

[stubs] Remove dead string copying code

Review-Url: https://codereview.chromium.org/2600763002
Cr-Commit-Position: refs/heads/master@{#41956}
parent 4cdee4fd
......@@ -2064,46 +2064,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 };
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding) {
if (FLAG_debug_code) {
// Check that destination is word aligned.
__ tst(dest, Operand(kPointerAlignmentMask));
__ Check(eq, kDestinationOfCopyNotAligned);
}
// Assumes word reads and writes are little endian.
// Nothing to do for zero characters.
Label done;
if (encoding == String::TWO_BYTE_ENCODING) {
__ add(count, count, Operand(count), SetCC);
}
Register limit = count; // Read until dest equals this.
__ add(limit, dest, Operand(count));
Label loop_entry, loop;
// Copy bytes from src to dest until dest hits limit.
__ b(&loop_entry);
__ bind(&loop);
__ ldrb(scratch, MemOperand(src, 1, PostIndex), lt);
__ strb(scratch, MemOperand(dest, 1, PostIndex));
__ bind(&loop_entry);
__ cmp(dest, Operand(limit));
__ b(lt, &loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(
MacroAssembler* masm, Register left, Register right, Register scratch1,
Register scratch2, Register scratch3) {
......
......@@ -16,17 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
// is allowed to spend extra time setting up conditions to make copying
// faster. Copying of overlapping regions is not supported.
// Dest register ends at the position after the last character written.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in r0.
static void GenerateCompareFlatOneByteStrings(
MacroAssembler* masm, Register left, Register right, Register scratch1,
......
......@@ -2019,40 +2019,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding) {
DCHECK(!scratch.is(dest));
DCHECK(!scratch.is(src));
DCHECK(!scratch.is(count));
// Nothing to do for zero characters.
Label done;
__ test(count, count);
__ j(zero, &done);
// Make count the number of bytes to copy.
if (encoding == String::TWO_BYTE_ENCODING) {
__ shl(count, 1);
}
Label loop;
__ bind(&loop);
__ mov_b(scratch, Operand(src, 0));
__ mov_b(Operand(dest, 0), scratch);
__ inc(src);
__ inc(dest);
__ dec(count);
__ j(not_zero, &loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
......
......@@ -16,16 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm,
class StringHelper : public AllStatic {
public:
// Generate code for copying characters using the rep movs instruction.
// Copies ecx characters from esi to edi. Copying of overlapping regions is
// not supported.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one byte strings and returns result in eax.
static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm,
Register left, Register right,
......
......@@ -2207,51 +2207,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 };
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding) {
if (FLAG_debug_code) {
// Check that destination is word aligned.
__ And(scratch, dest, Operand(kPointerAlignmentMask));
__ Check(eq,
kDestinationOfCopyNotAligned,
scratch,
Operand(zero_reg));
}
// Assumes word reads and writes are little endian.
// Nothing to do for zero characters.
Label done;
if (encoding == String::TWO_BYTE_ENCODING) {
__ Addu(count, count, count);
}
Register limit = count; // Read until dest equals this.
__ Addu(limit, dest, Operand(count));
Label loop_entry, loop;
// Copy bytes from src to dest until dest hits limit.
__ Branch(&loop_entry);
__ bind(&loop);
__ lbu(scratch, MemOperand(src));
__ Addu(src, src, Operand(1));
__ sb(scratch, MemOperand(dest));
__ Addu(dest, dest, Operand(1));
__ bind(&loop_entry);
__ Branch(&loop, lt, dest, Operand(limit));
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(
MacroAssembler* masm, Register left, Register right, Register scratch1,
Register scratch2, Register scratch3) {
......
......@@ -16,17 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
// is allowed to spend extra time setting up conditions to make copying
// faster. Copying of overlapping regions is not supported.
// Dest register ends at the position after the last character written.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in v0.
static void GenerateCompareFlatOneByteStrings(
MacroAssembler* masm, Register left, Register right, Register scratch1,
......
......@@ -2210,51 +2210,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 };
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding) {
if (FLAG_debug_code) {
// Check that destination is word aligned.
__ And(scratch, dest, Operand(kPointerAlignmentMask));
__ Check(eq,
kDestinationOfCopyNotAligned,
scratch,
Operand(zero_reg));
}
// Assumes word reads and writes are little endian.
// Nothing to do for zero characters.
Label done;
if (encoding == String::TWO_BYTE_ENCODING) {
__ Daddu(count, count, count);
}
Register limit = count; // Read until dest equals this.
__ Daddu(limit, dest, Operand(count));
Label loop_entry, loop;
// Copy bytes from src to dest until dest hits limit.
__ Branch(&loop_entry);
__ bind(&loop);
__ lbu(scratch, MemOperand(src));
__ daddiu(src, src, 1);
__ sb(scratch, MemOperand(dest));
__ daddiu(dest, dest, 1);
__ bind(&loop_entry);
__ Branch(&loop, lt, dest, Operand(limit));
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(
MacroAssembler* masm, Register left, Register right, Register scratch1,
Register scratch2, Register scratch3) {
......
......@@ -16,17 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
// is allowed to spend extra time setting up conditions to make copying
// faster. Copying of overlapping regions is not supported.
// Dest register ends at the position after the last character written.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in v0.
static void GenerateCompareFlatOneByteStrings(
MacroAssembler* masm, Register left, Register right, Register scratch1,
......
......@@ -2159,45 +2159,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
enum CopyCharactersFlags { COPY_ONE_BYTE = 1, DEST_ALWAYS_ALIGNED = 2 };
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, Register dest,
Register src, Register count,
Register scratch,
String::Encoding encoding) {
if (FLAG_debug_code) {
// Check that destination is word aligned.
__ andi(r0, dest, Operand(kPointerAlignmentMask));
__ Check(eq, kDestinationOfCopyNotAligned, cr0);
}
// Nothing to do for zero characters.
Label done;
if (encoding == String::TWO_BYTE_ENCODING) {
// double the length
__ add(count, count, count, LeaveOE, SetRC);
__ beq(&done, cr0);
} else {
__ cmpi(count, Operand::Zero());
__ beq(&done);
}
// Copy count bytes from src to dst.
Label byte_loop;
__ mtctr(count);
__ bind(&byte_loop);
__ lbz(scratch, MemOperand(src));
__ addi(src, src, Operand(1));
__ stb(scratch, MemOperand(dest));
__ addi(dest, dest, Operand(1));
__ bdnz(&byte_loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
......
......@@ -16,15 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
// is allowed to spend extra time setting up conditions to make copying
// faster. Copying of overlapping regions is not supported.
// Dest register ends at the position after the last character written.
static void GenerateCopyCharacters(MacroAssembler* masm, Register dest,
Register src, Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in r0.
static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm,
Register left, Register right,
......
......@@ -2155,44 +2155,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
enum CopyCharactersFlags { COPY_ASCII = 1, DEST_ALWAYS_ALIGNED = 2 };
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, Register dest,
Register src, Register count,
Register scratch,
String::Encoding encoding) {
if (FLAG_debug_code) {
// Check that destination is word aligned.
__ mov(r0, Operand(kPointerAlignmentMask));
__ AndP(r0, dest);
__ Check(eq, kDestinationOfCopyNotAligned, cr0);
}
// Nothing to do for zero characters.
Label done;
if (encoding == String::TWO_BYTE_ENCODING) {
// double the length
__ AddP(count, count, count);
__ beq(&done, Label::kNear);
} else {
__ CmpP(count, Operand::Zero());
__ beq(&done, Label::kNear);
}
// Copy count bytes from src to dst.
Label byte_loop;
// TODO(joransiu): Convert into MVC loop
__ bind(&byte_loop);
__ LoadlB(scratch, MemOperand(src));
__ la(src, MemOperand(src, 1));
__ stc(scratch, MemOperand(dest));
__ la(dest, MemOperand(dest, 1));
__ BranchOnCount(count, &byte_loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
......
......@@ -14,15 +14,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying a large number of characters. This function
// is allowed to spend extra time setting up conditions to make copying
// faster. Copying of overlapping regions is not supported.
// Dest register ends at the position after the last character written.
static void GenerateCopyCharacters(MacroAssembler* masm, Register dest,
Register src, Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in r0.
static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm,
Register left, Register right,
......
......@@ -1965,37 +1965,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
String::Encoding encoding) {
// Nothing to do for zero characters.
Label done;
__ testl(count, count);
__ j(zero, &done, Label::kNear);
// Make count the number of bytes to copy.
if (encoding == String::TWO_BYTE_ENCODING) {
STATIC_ASSERT(2 == sizeof(uc16));
__ addl(count, count);
}
// Copy remaining characters.
Label loop;
__ bind(&loop);
__ movb(kScratchRegister, Operand(src, 0));
__ movb(Operand(dest, 0), kScratchRegister);
__ incp(src);
__ incp(dest);
__ decl(count);
__ j(not_zero, &loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
......
......@@ -14,15 +14,6 @@ void ArrayNativeCode(MacroAssembler* masm, Label* call_generic_code);
class StringHelper : public AllStatic {
public:
// Generate code for copying characters using the rep movs instruction.
// Copies rcx characters from rsi to rdi. Copying of overlapping regions is
// not supported.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
String::Encoding encoding);
// Compares two flat one-byte strings and returns result in rax.
static void GenerateCompareFlatOneByteStrings(
MacroAssembler* masm, Register left, Register right, Register scratch1,
......
......@@ -1867,40 +1867,6 @@ void StringCharFromCodeGenerator::GenerateSlow(
__ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase);
}
void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding) {
DCHECK(!scratch.is(dest));
DCHECK(!scratch.is(src));
DCHECK(!scratch.is(count));
// Nothing to do for zero characters.
Label done;
__ test(count, count);
__ j(zero, &done);
// Make count the number of bytes to copy.
if (encoding == String::TWO_BYTE_ENCODING) {
__ shl(count, 1);
}
Label loop;
__ bind(&loop);
__ mov_b(scratch, Operand(src, 0));
__ mov_b(Operand(dest, 0), scratch);
__ inc(src);
__ inc(dest);
__ dec(count);
__ j(not_zero, &loop);
__ bind(&done);
}
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm,
Register left,
Register right,
......
......@@ -16,16 +16,6 @@ void ArrayNativeCode(MacroAssembler* masm,
class StringHelper : public AllStatic {
public:
// Generate code for copying characters using the rep movs instruction.
// Copies ecx characters from esi to edi. Copying of overlapping regions is
// not supported.
static void GenerateCopyCharacters(MacroAssembler* masm,
Register dest,
Register src,
Register count,
Register scratch,
String::Encoding encoding);
// Compares two flat one byte strings and returns result in eax.
static void GenerateCompareFlatOneByteStrings(MacroAssembler* masm,
Register left, Register right,
......
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