Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: src/ia32/macro-assembler-ia32.cc

Issue 12314155: Allow direct allocation in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/macro-assembler-ia32.cc
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc
index 494a1bf21f5d785971b35b7554933e601c88df9a..bce0f2f0d5b3cdbf656f91899421179f61d8cd84 100644
--- a/src/ia32/macro-assembler-ia32.cc
+++ b/src/ia32/macro-assembler-ia32.cc
@@ -1214,7 +1214,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) ?
danno 2013/03/12 11:28:20 Does it make sense to create two utility functions
Hannes Payer (out of office) 2013/03/12 12:37:27 Done.
+ ExternalReference::old_pointer_space_allocation_top_address(isolate()) :
ExternalReference::new_space_allocation_top_address(isolate());
// Just return if allocation top is already known.
@@ -1223,7 +1224,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;
@@ -1231,39 +1232,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()) {
@@ -1286,7 +1289,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));
@@ -1299,8 +1302,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)) {
@@ -1308,11 +1313,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;
@@ -1340,6 +1345,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.
@@ -1399,7 +1405,7 @@ void MacroAssembler::AllocateInNewSpace(
}
// Update allocation top.
- UpdateAllocationTopHelper(result_end, scratch);
+ UpdateAllocationTopHelper(result_end, scratch, flags);
}
@@ -1410,6 +1416,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.
@@ -1459,7 +1466,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
}
// Update allocation top.
- UpdateAllocationTopHelper(result_end, scratch);
+ UpdateAllocationTopHelper(result_end, scratch, flags);
}
@@ -1482,12 +1489,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),
@@ -1575,12 +1578,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),
@@ -1597,12 +1596,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),
@@ -1615,12 +1610,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),
@@ -1633,12 +1624,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),
@@ -1651,12 +1638,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),

Powered by Google App Engine
This is Rietveld 408576698