Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 5e4f21129159cf5334e1ef9c82dc9f0532abee74..b6f9d4e3d09be2f879745085d088cd80aefc4da8 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1191,7 +1191,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. |
@@ -1200,7 +1201,7 @@ void MacroAssembler::LoadAllocationTopHelper(Register result, |
ASSERT(scratch.is(no_reg)); |
#ifdef DEBUG |
// Assert that result actually contains top on entry. |
- cmp(result, Operand::StaticVariable(new_space_allocation_top)); |
+ cmp(result, Operand::StaticVariable(allocation_top)); |
Check(equal, "Unexpected allocation top"); |
#endif |
return; |
@@ -1208,39 +1209,41 @@ void MacroAssembler::LoadAllocationTopHelper(Register result, |
// Move address of new object to result. Use scratch register if available. |
if (scratch.is(no_reg)) { |
- mov(result, Operand::StaticVariable(new_space_allocation_top)); |
+ mov(result, Operand::StaticVariable(allocation_top)); |
} else { |
- mov(scratch, Immediate(new_space_allocation_top)); |
+ mov(scratch, Immediate(allocation_top)); |
mov(result, Operand(scratch, 0)); |
} |
} |
void MacroAssembler::UpdateAllocationTopHelper(Register result_end, |
- Register scratch) { |
+ Register scratch, |
+ AllocationFlags flags) { |
if (emit_debug_code()) { |
test(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. Use scratch if available. |
if (scratch.is(no_reg)) { |
- mov(Operand::StaticVariable(new_space_allocation_top), result_end); |
+ mov(Operand::StaticVariable(allocation_top), result_end); |
} else { |
mov(Operand(scratch, 0), 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()) { |
@@ -1263,7 +1266,7 @@ void MacroAssembler::AllocateInNewSpace(int object_size, |
// Align the next allocation. Storing the filler map without checking top is |
// always safe because the limit of the heap is always aligned. |
- if ((flags & DOUBLE_ALIGNMENT) != 0) { |
+ if (((flags & PRETENURE) == 0) && ((flags & DOUBLE_ALIGNMENT) != 0)) { |
ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
Label aligned; |
test(result, Immediate(kDoubleAlignmentMask)); |
@@ -1276,8 +1279,10 @@ void MacroAssembler::AllocateInNewSpace(int object_size, |
Register top_reg = result_end.is_valid() ? result_end : result; |
- // Calculate new top and bail out if new space is exhausted. |
- ExternalReference new_space_allocation_limit = |
+ // Calculate new top and bail out if space is exhausted. |
+ ExternalReference allocation_limit = ((flags & PRETENURE) != 0) ? |
+ ExternalReference::old_pointer_space_allocation_limit_address( |
+ isolate()) : |
ExternalReference::new_space_allocation_limit_address(isolate()); |
if (!top_reg.is(result)) { |
@@ -1285,11 +1290,11 @@ void MacroAssembler::AllocateInNewSpace(int object_size, |
} |
add(top_reg, Immediate(object_size)); |
j(carry, gc_required); |
- cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); |
+ cmp(top_reg, Operand::StaticVariable(allocation_limit)); |
j(above, gc_required); |
// Update allocation top. |
- UpdateAllocationTopHelper(top_reg, scratch); |
+ UpdateAllocationTopHelper(top_reg, scratch, flags); |
// Tag result if requested. |
bool tag_result = (flags & TAG_OBJECT) != 0; |
@@ -1317,6 +1322,7 @@ void MacroAssembler::AllocateInNewSpace( |
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. |
@@ -1376,7 +1382,7 @@ void MacroAssembler::AllocateInNewSpace( |
} |
// Update allocation top. |
- UpdateAllocationTopHelper(result_end, scratch); |
+ UpdateAllocationTopHelper(result_end, scratch, flags); |
} |
@@ -1387,6 +1393,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. |
@@ -1436,7 +1443,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size, |
} |
// Update allocation top. |
- UpdateAllocationTopHelper(result_end, scratch); |
+ UpdateAllocationTopHelper(result_end, scratch, flags); |
} |
@@ -1459,12 +1466,8 @@ void MacroAssembler::AllocateHeapNumber(Register result, |
Register scratch2, |
Label* gc_required) { |
// Allocate heap number in new space. |
- AllocateInNewSpace(HeapNumber::kSize, |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, |
+ TAG_OBJECT); |
// Set the map. |
mov(FieldOperand(result, HeapObject::kMapOffset), |
@@ -1552,12 +1555,8 @@ void MacroAssembler::AllocateAsciiString(Register result, |
ASSERT(length > 0); |
// Allocate ASCII string in new space. |
- AllocateInNewSpace(SeqOneByteString::SizeFor(length), |
- result, |
- scratch1, |
- scratch2, |
- gc_required, |
- TAG_OBJECT); |
+ Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2, |
+ gc_required, TAG_OBJECT); |
// Set the map, length and hash field. |
mov(FieldOperand(result, HeapObject::kMapOffset), |
@@ -1574,12 +1573,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. |
mov(FieldOperand(result, HeapObject::kMapOffset), |
@@ -1592,12 +1587,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. |
mov(FieldOperand(result, HeapObject::kMapOffset), |
@@ -1610,12 +1601,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. |
mov(FieldOperand(result, HeapObject::kMapOffset), |
@@ -1628,12 +1615,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. |
mov(FieldOperand(result, HeapObject::kMapOffset), |