Index: src/arm/code-stubs-arm.cc |
=================================================================== |
--- src/arm/code-stubs-arm.cc (revision 5455) |
+++ src/arm/code-stubs-arm.cc (working copy) |
@@ -4144,17 +4144,21 @@ |
// Check bounds and smi-ness. |
- __ ldr(r7, MemOperand(sp, kToOffset)); |
- __ ldr(r6, MemOperand(sp, kFromOffset)); |
+ Register to = r6; |
+ Register from = r7; |
+ __ Ldrd(to, from, MemOperand(sp, kToOffset)); |
+ STATIC_ASSERT(kFromOffset == kToOffset + 4); |
STATIC_ASSERT(kSmiTag == 0); |
STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); |
// I.e., arithmetic shift right by one un-smi-tags. |
- __ mov(r2, Operand(r7, ASR, 1), SetCC); |
- __ mov(r3, Operand(r6, ASR, 1), SetCC, cc); |
- // If either r2 or r6 had the smi tag bit set, then carry is set now. |
+ __ mov(r2, Operand(to, ASR, 1), SetCC); |
+ __ mov(r3, Operand(from, ASR, 1), SetCC, cc); |
+ // If either to or from had the smi tag bit set, then carry is set now. |
__ b(cs, &runtime); // Either "from" or "to" is not a smi. |
__ b(mi, &runtime); // From is negative. |
+ // Both to and from are smis. |
+ |
__ sub(r2, r2, Operand(r3), SetCC); |
__ b(mi, &runtime); // Fail if from > to. |
// Special handling of sub-strings of length 1 and 2. One character strings |
@@ -4165,8 +4169,8 @@ |
// r2: length |
// r3: from index (untaged smi) |
- // r6: from (smi) |
- // r7: to (smi) |
+ // r6 (a.k.a. to): to (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
// Make sure first argument is a sequential (or flat) string. |
__ ldr(r5, MemOperand(sp, kStringOffset)); |
@@ -4178,10 +4182,10 @@ |
// r1: instance type |
// r2: length |
- // r3: from index (untaged smi) |
+ // r3: from index (untagged smi) |
// r5: string |
- // r6: from (smi) |
- // r7: to (smi) |
+ // r6 (a.k.a. to): to (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
Label seq_string; |
__ and_(r4, r1, Operand(kStringRepresentationMask)); |
STATIC_ASSERT(kSeqStringTag < kConsStringTag); |
@@ -4207,17 +4211,17 @@ |
// r2: length |
// r3: from index (untaged smi) |
// r5: string |
- // r6: from (smi) |
- // r7: to (smi) |
+ // r6 (a.k.a. to): to (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
__ ldr(r4, FieldMemOperand(r5, String::kLengthOffset)); |
- __ cmp(r4, Operand(r7)); |
+ __ cmp(r4, Operand(to)); |
__ b(lt, &runtime); // Fail if to > length. |
Søren Thygesen Gjesse
2010/09/15 10:09:07
Looks as if "to" is not live after here, maybe set
Erik Corry
2010/09/15 10:22:42
Done.
|
// r1: instance type. |
// r2: result string length. |
// r3: from index (untaged smi) |
// r5: string. |
- // r6: from offset (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
// Check for flat ascii string. |
Label non_ascii_flat; |
__ tst(r1, Operand(kStringEncodingMask)); |
@@ -4259,12 +4263,12 @@ |
// r0: result string. |
// r2: result string length. |
// r5: string. |
- // r6: from offset (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
// Locate first character of result. |
__ add(r1, r0, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
// Locate 'from' character of string. |
__ add(r5, r5, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); |
- __ add(r5, r5, Operand(r6, ASR, 1)); |
+ __ add(r5, r5, Operand(from, ASR, 1)); |
// r0: result string. |
// r1: first character of result string. |
@@ -4280,7 +4284,7 @@ |
__ bind(&non_ascii_flat); |
// r2: result string length. |
// r5: string. |
- // r6: from offset (smi) |
+ // r7 (a.k.a. from): from offset (smi) |
// Check for flat two byte string. |
// Allocate the result. |
@@ -4292,18 +4296,18 @@ |
// Locate first character of result. |
__ add(r1, r0, Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
// Locate 'from' character of string. |
- __ add(r5, r5, Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
+ __ add(r5, r5, Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
// As "from" is a smi it is 2 times the value which matches the size of a two |
// byte character. |
- __ add(r5, r5, Operand(r6)); |
+ __ add(r5, r5, Operand(from)); |
// r0: result string. |
// r1: first character of result. |
// r2: result length. |
// r5: first character of string to copy. |
STATIC_ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); |
- StringHelper::GenerateCopyCharactersLong(masm, r1, r5, r2, r3, r4, r6, r7, r9, |
- DEST_ALWAYS_ALIGNED); |
+ StringHelper::GenerateCopyCharactersLong(masm, r1, r5, r2, r3, r4, r6, r7, |
Søren Thygesen Gjesse
2010/09/15 10:09:07
All arguments on a single (new line)?
Erik Corry
2010/09/15 10:22:42
Done.
|
+ r9, DEST_ALWAYS_ALIGNED); |
__ IncrementCounter(&Counters::sub_string_native, 1, r3, r4); |
__ add(sp, sp, Operand(3 * kPointerSize)); |
__ Ret(); |
@@ -4379,8 +4383,7 @@ |
// Stack frame on entry. |
// sp[0]: right string |
// sp[4]: left string |
- __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); // left |
- __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); // right |
+ __ Ldrd(r0 , r1, MemOperand(sp)); // Load right in r0, left in r1. |
Label not_same; |
__ cmp(r0, r1); |
@@ -4395,12 +4398,12 @@ |
__ bind(¬_same); |
// Check that both objects are sequential ascii strings. |
- __ JumpIfNotBothSequentialAsciiStrings(r0, r1, r2, r3, &runtime); |
+ __ JumpIfNotBothSequentialAsciiStrings(r1, r0, r2, r3, &runtime); |
// Compare flat ascii strings natively. Remove arguments from stack first. |
__ IncrementCounter(&Counters::string_compare_native, 1, r2, r3); |
__ add(sp, sp, Operand(2 * kPointerSize)); |
- GenerateCompareFlatAsciiStrings(masm, r0, r1, r2, r3, r4, r5); |
+ GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); |
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
// tagged as a small integer. |