Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index 807e90dbec86555ee90921dc3e1349204897e398..e2ef2c74b8e83d15d291876242edb8ade869af38 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -3691,7 +3691,8 @@ void MacroAssembler::LoadFromNumberDictionary(Label* miss, |
void MacroAssembler::LoadAllocationTopHelper(Register result, |
Register scratch, |
AllocationFlags flags) { |
- ExternalReference new_space_allocation_top = |
+ ExternalReference allocation_top = ((flags & PRETENURE) != 0) ? |
+ ExternalReference::old_pointer_space_allocation_top_address(isolate()) : |
ExternalReference::new_space_allocation_top_address(isolate()); |
// Just return if allocation top is already known. |
@@ -3700,7 +3701,7 @@ void MacroAssembler::LoadAllocationTopHelper(Register result, |
ASSERT(!scratch.is_valid()); |
#ifdef DEBUG |
// Assert that result actually contains top on entry. |
- Operand top_operand = ExternalOperand(new_space_allocation_top); |
+ Operand top_operand = ExternalOperand(allocation_top); |
cmpq(result, top_operand); |
Check(equal, "Unexpected allocation top"); |
#endif |
@@ -3710,22 +3711,24 @@ void MacroAssembler::LoadAllocationTopHelper(Register result, |
// Move address of new object to result. Use scratch register if available, |
// and keep address in scratch until call to UpdateAllocationTopHelper. |
if (scratch.is_valid()) { |
- LoadAddress(scratch, new_space_allocation_top); |
+ LoadAddress(scratch, allocation_top); |
movq(result, Operand(scratch, 0)); |
} else { |
- Load(result, new_space_allocation_top); |
+ Load(result, allocation_top); |
} |
} |
void MacroAssembler::UpdateAllocationTopHelper(Register result_end, |
- Register scratch) { |
+ Register scratch, |
+ AllocationFlags flags) { |
if (emit_debug_code()) { |
testq(result_end, Immediate(kObjectAlignmentMask)); |
Check(zero, "Unaligned allocation in new space"); |
} |
- ExternalReference new_space_allocation_top = |
+ ExternalReference allocation_top = ((flags & PRETENURE) != 0) ? |
+ ExternalReference::old_pointer_space_allocation_top_address(isolate()) : |
ExternalReference::new_space_allocation_top_address(isolate()); |
// Update new top. |
@@ -3733,17 +3736,17 @@ void MacroAssembler::UpdateAllocationTopHelper(Register result_end, |
// Scratch already contains address of allocation top. |
movq(Operand(scratch, 0), result_end); |
} else { |
- Store(new_space_allocation_top, result_end); |
+ Store(allocation_top, result_end); |
} |
} |
-void MacroAssembler::AllocateInNewSpace(int object_size, |
- Register result, |
- Register result_end, |
- Register scratch, |
- Label* gc_required, |
- AllocationFlags flags) { |
+void MacroAssembler::Allocate(int object_size, |
+ Register result, |
+ Register result_end, |
+ Register scratch, |
+ Label* gc_required, |
+ AllocationFlags flags) { |
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
if (!FLAG_inline_new) { |
if (emit_debug_code()) { |
@@ -3772,7 +3775,9 @@ void MacroAssembler::AllocateInNewSpace(int object_size, |
} |
// Calculate new top and bail out if new space is exhausted. |
- ExternalReference new_space_allocation_limit = |
+ ExternalReference allocation_limit = ((flags & PRETENURE) != 0) ? |
+ ExternalReference::old_pointer_space_allocation_limit_address( |
+ isolate()) : |
ExternalReference::new_space_allocation_limit_address(isolate()); |
Register top_reg = result_end.is_valid() ? result_end : result; |
@@ -3782,12 +3787,12 @@ void MacroAssembler::AllocateInNewSpace(int object_size, |
} |
addq(top_reg, Immediate(object_size)); |
j(carry, gc_required); |
- Operand limit_operand = ExternalOperand(new_space_allocation_limit); |
+ Operand limit_operand = ExternalOperand(allocation_limit); |
cmpq(top_reg, limit_operand); |
j(above, gc_required); |
// Update allocation top. |
- UpdateAllocationTopHelper(top_reg, scratch); |
+ UpdateAllocationTopHelper(top_reg, scratch, flags); |
bool tag_result = (flags & TAG_OBJECT) != 0; |
if (top_reg.is(result)) { |
@@ -3813,6 +3818,7 @@ void MacroAssembler::AllocateInNewSpace(int header_size, |
Label* gc_required, |
AllocationFlags flags) { |
ASSERT((flags & SIZE_IN_WORDS) == 0); |
+ ASSERT((flags & PRETENURE) == 0); |
if (!FLAG_inline_new) { |
if (emit_debug_code()) { |
// Trash the registers to simulate an allocation failure. |
@@ -3852,7 +3858,7 @@ void MacroAssembler::AllocateInNewSpace(int header_size, |
j(above, gc_required); |
// Update allocation top. |
- UpdateAllocationTopHelper(result_end, scratch); |
+ UpdateAllocationTopHelper(result_end, scratch, flags); |
// Tag the result if requested. |
if ((flags & TAG_OBJECT) != 0) { |
@@ -3869,6 +3875,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size, |
Label* gc_required, |
AllocationFlags flags) { |
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0); |
+ ASSERT((flags & PRETENURE) == 0); |
if (!FLAG_inline_new) { |
if (emit_debug_code()) { |
// Trash the registers to simulate an allocation failure. |
@@ -3900,7 +3907,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size, |
j(above, gc_required); |
// Update allocation top. |
- UpdateAllocationTopHelper(result_end, scratch); |
+ UpdateAllocationTopHelper(result_end, scratch, flags); |
// Align the next allocation. Storing the filler map without checking top is |
// always safe because the limit of the heap is always aligned. |
@@ -3935,12 +3942,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, |
Register scratch, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(HeapNumber::kSize, |
- result, |
- scratch, |
- no_reg, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(HeapNumber::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
// Set the map. |
LoadRoot(kScratchRegister, Heap::kHeapNumberMapRootIndex); |
@@ -4030,12 +4032,8 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, |
Register scratch2, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(ConsString::kSize, |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, |
+ TAG_OBJECT); |
// Set the map. The other fields are left uninitialized. |
LoadRoot(kScratchRegister, Heap::kConsStringMapRootIndex); |
@@ -4048,12 +4046,8 @@ void MacroAssembler::AllocateAsciiConsString(Register result, |
Register scratch2, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(ConsString::kSize, |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, |
+ TAG_OBJECT); |
// Set the map. The other fields are left uninitialized. |
LoadRoot(kScratchRegister, Heap::kConsAsciiStringMapRootIndex); |
@@ -4066,12 +4060,8 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result, |
Register scratch2, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(SlicedString::kSize, |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, |
+ TAG_OBJECT); |
// Set the map. The other fields are left uninitialized. |
LoadRoot(kScratchRegister, Heap::kSlicedStringMapRootIndex); |
@@ -4084,12 +4074,8 @@ void MacroAssembler::AllocateAsciiSlicedString(Register result, |
Register scratch2, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(SlicedString::kSize, |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, |
+ TAG_OBJECT); |
// Set the map. The other fields are left uninitialized. |
LoadRoot(kScratchRegister, Heap::kSlicedAsciiStringMapRootIndex); |