Chromium Code Reviews| Index: src/arm/macro-assembler-arm.cc |
| =================================================================== |
| --- src/arm/macro-assembler-arm.cc (revision 4616) |
| +++ src/arm/macro-assembler-arm.cc (working copy) |
| @@ -933,6 +933,11 @@ |
| ASSERT(!result.is(scratch1)); |
| ASSERT(!scratch1.is(scratch2)); |
| + // Make object size into bytes. |
| + if ((flags & SIZE_IN_WORDS) != 0) { |
| + object_size *= kPointerSize; |
| + } |
| + |
| // Load address of new object into result and allocation top address into |
| // scratch1. |
| ExternalReference new_space_allocation_top = |
| @@ -955,7 +960,7 @@ |
| ExternalReference::new_space_allocation_limit_address(); |
| mov(scratch2, Operand(new_space_allocation_limit)); |
| ldr(scratch2, MemOperand(scratch2)); |
| - add(result, result, Operand(object_size * kPointerSize)); |
| + add(result, result, Operand(object_size)); |
|
Vyacheslav Egorov (Chromium)
2010/05/07 13:18:26
May be add some ASSERTion on object_size alignment
|
| cmp(result, Operand(scratch2)); |
| b(hi, gc_required); |
| @@ -968,10 +973,9 @@ |
| // Tag and adjust back to start of new object. |
| if ((flags & TAG_OBJECT) != 0) { |
| - sub(result, result, Operand((object_size * kPointerSize) - |
| - kHeapObjectTag)); |
| + sub(result, result, Operand(object_size - kHeapObjectTag)); |
| } else { |
| - sub(result, result, Operand(object_size * kPointerSize)); |
| + sub(result, result, Operand(object_size)); |
| } |
| } |
| @@ -1008,7 +1012,11 @@ |
| ExternalReference::new_space_allocation_limit_address(); |
| mov(scratch2, Operand(new_space_allocation_limit)); |
| ldr(scratch2, MemOperand(scratch2)); |
| - add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| + if ((flags & SIZE_IN_WORDS) != 0) { |
| + add(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| + } else { |
| + add(result, result, Operand(object_size)); |
| + } |
| cmp(result, Operand(scratch2)); |
| b(hi, gc_required); |
| @@ -1020,7 +1028,11 @@ |
| str(result, MemOperand(scratch1)); |
| // Adjust back to start of new object. |
| - sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| + if ((flags & SIZE_IN_WORDS) != 0) { |
| + sub(result, result, Operand(object_size, LSL, kPointerSizeLog2)); |
| + } else { |
| + sub(result, result, Operand(object_size)); |
| + } |
| // Tag object if requested. |
| if ((flags & TAG_OBJECT) != 0) { |
| @@ -1061,10 +1073,7 @@ |
| mov(scratch1, Operand(length, LSL, 1)); // Length in bytes, not chars. |
| add(scratch1, scratch1, |
| Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); |
| - // AllocateInNewSpace expects the size in words, so we can round down |
| - // to kObjectAlignment and divide by kPointerSize in the same shift. |
| - ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1); |
| - mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2)); |
| + and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); |
| // Allocate two-byte string in new space. |
| AllocateInNewSpace(scratch1, |
| @@ -1095,10 +1104,7 @@ |
| ASSERT(kCharSize == 1); |
| add(scratch1, length, |
| Operand(kObjectAlignmentMask + SeqAsciiString::kHeaderSize)); |
| - // AllocateInNewSpace expects the size in words, so we can round down |
| - // to kObjectAlignment and divide by kPointerSize in the same shift. |
| - ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1); |
| - mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2)); |
| + and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); |
| // Allocate ASCII string in new space. |
| AllocateInNewSpace(scratch1, |
| @@ -1122,7 +1128,7 @@ |
| Register scratch1, |
| Register scratch2, |
| Label* gc_required) { |
| - AllocateInNewSpace(ConsString::kSize / kPointerSize, |
| + AllocateInNewSpace(ConsString::kSize, |
| result, |
| scratch1, |
| scratch2, |
| @@ -1142,7 +1148,7 @@ |
| Register scratch1, |
| Register scratch2, |
| Label* gc_required) { |
| - AllocateInNewSpace(ConsString::kSize / kPointerSize, |
| + AllocateInNewSpace(ConsString::kSize, |
| result, |
| scratch1, |
| scratch2, |
| @@ -1556,7 +1562,7 @@ |
| Label* gc_required) { |
| // Allocate an object in the heap for the heap number and tag it as a heap |
| // object. |
| - AllocateInNewSpace(HeapNumber::kSize / kPointerSize, |
| + AllocateInNewSpace(HeapNumber::kSize, |
| result, |
| scratch1, |
| scratch2, |