| Index: src/arm/macro-assembler-arm.cc
|
| diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
|
| index bc3c7864209a46cd2444301a14eff384d9ae962d..64788523cb746976f57e9a5611060533661dbef5 100644
|
| --- a/src/arm/macro-assembler-arm.cc
|
| +++ b/src/arm/macro-assembler-arm.cc
|
| @@ -1554,12 +1554,33 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss,
|
| }
|
|
|
|
|
| -void MacroAssembler::AllocateInNewSpace(int object_size,
|
| - Register result,
|
| - Register scratch1,
|
| - Register scratch2,
|
| - Label* gc_required,
|
| - AllocationFlags flags) {
|
| +ExternalReference MacroAssembler::GetTopAddress(AllocationTarget target) {
|
| + if (target == NEW_SPACE) {
|
| + return ExternalReference::new_space_allocation_top_address(isolate());
|
| + } else {
|
| + return ExternalReference::old_pointer_space_allocation_top_address(
|
| + isolate());
|
| + }
|
| +}
|
| +
|
| +
|
| +ExternalReference MacroAssembler::GetLimitAddress(AllocationTarget target) {
|
| + if (target == NEW_SPACE) {
|
| + return ExternalReference::new_space_allocation_limit_address(isolate());
|
| + } else {
|
| + return ExternalReference::old_pointer_space_allocation_limit_address(
|
| + isolate());
|
| + }
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::Allocate(int object_size,
|
| + Register result,
|
| + Register scratch1,
|
| + Register scratch2,
|
| + Label* gc_required,
|
| + AllocationFlags flags,
|
| + AllocationTarget target) {
|
| if (!FLAG_inline_new) {
|
| if (emit_debug_code()) {
|
| // Trash the registers to simulate an allocation failure.
|
| @@ -1587,21 +1608,19 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
| // The values must be adjacent in memory to allow the use of LDM.
|
| // Also, assert that the registers are numbered such that the values
|
| // are loaded in the correct order.
|
| - ExternalReference new_space_allocation_top =
|
| - ExternalReference::new_space_allocation_top_address(isolate());
|
| - ExternalReference new_space_allocation_limit =
|
| - ExternalReference::new_space_allocation_limit_address(isolate());
|
| + ExternalReference allocation_top = GetTopAddress(target);
|
| + ExternalReference allocation_limit = GetLimitAddress(target);
|
| intptr_t top =
|
| - reinterpret_cast<intptr_t>(new_space_allocation_top.address());
|
| + reinterpret_cast<intptr_t>(allocation_top.address());
|
| intptr_t limit =
|
| - reinterpret_cast<intptr_t>(new_space_allocation_limit.address());
|
| + reinterpret_cast<intptr_t>(allocation_limit.address());
|
| ASSERT((limit - top) == kPointerSize);
|
| ASSERT(result.code() < ip.code());
|
|
|
| // Set up allocation top address and object size registers.
|
| Register topaddr = scratch1;
|
| Register obj_size_reg = scratch2;
|
| - mov(topaddr, Operand(new_space_allocation_top));
|
| + mov(topaddr, Operand(allocation_top));
|
| Operand obj_size_operand = Operand(object_size);
|
| if (!obj_size_operand.is_single_instruction(this)) {
|
| // We are about to steal IP, so we need to load this value first
|
| @@ -1848,12 +1867,8 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
|
| Register scratch1,
|
| Register scratch2,
|
| Label* gc_required) {
|
| - AllocateInNewSpace(ConsString::kSize,
|
| - result,
|
| - scratch1,
|
| - scratch2,
|
| - gc_required,
|
| - TAG_OBJECT);
|
| + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
|
| + TAG_OBJECT, NEW_SPACE);
|
|
|
| InitializeNewString(result,
|
| length,
|
| @@ -1868,12 +1883,8 @@ void MacroAssembler::AllocateAsciiConsString(Register result,
|
| Register scratch1,
|
| Register scratch2,
|
| Label* gc_required) {
|
| - AllocateInNewSpace(ConsString::kSize,
|
| - result,
|
| - scratch1,
|
| - scratch2,
|
| - gc_required,
|
| - TAG_OBJECT);
|
| + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
|
| + TAG_OBJECT, NEW_SPACE);
|
|
|
| InitializeNewString(result,
|
| length,
|
| @@ -1888,12 +1899,8 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
|
| Register scratch1,
|
| Register scratch2,
|
| Label* gc_required) {
|
| - AllocateInNewSpace(SlicedString::kSize,
|
| - result,
|
| - scratch1,
|
| - scratch2,
|
| - gc_required,
|
| - TAG_OBJECT);
|
| + Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
|
| + TAG_OBJECT, NEW_SPACE);
|
|
|
| InitializeNewString(result,
|
| length,
|
| @@ -1908,12 +1915,8 @@ void MacroAssembler::AllocateAsciiSlicedString(Register result,
|
| Register scratch1,
|
| Register scratch2,
|
| Label* gc_required) {
|
| - AllocateInNewSpace(SlicedString::kSize,
|
| - result,
|
| - scratch1,
|
| - scratch2,
|
| - gc_required,
|
| - TAG_OBJECT);
|
| + Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
|
| + TAG_OBJECT, NEW_SPACE);
|
|
|
| InitializeNewString(result,
|
| length,
|
| @@ -3252,13 +3255,9 @@ void MacroAssembler::AllocateHeapNumber(Register result,
|
| TaggingMode tagging_mode) {
|
| // Allocate an object in the heap for the heap number and tag it as a heap
|
| // object.
|
| - AllocateInNewSpace(HeapNumber::kSize,
|
| - result,
|
| - scratch1,
|
| - scratch2,
|
| - gc_required,
|
| - tagging_mode == TAG_RESULT ? TAG_OBJECT :
|
| - NO_ALLOCATION_FLAGS);
|
| + Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required,
|
| + tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS,
|
| + NEW_SPACE);
|
|
|
| // Store heap number map in the allocated object.
|
| AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
|
|
|