X64: Update allocation to work with no scratch registers at all.
Review URL: http://codereview.chromium.org/1856001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4559 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1a750a2110
commit
c815de4f52
@ -2346,7 +2346,7 @@ void MacroAssembler::LoadAllocationTopHelper(Register result,
|
|||||||
// Just return if allocation top is already known.
|
// Just return if allocation top is already known.
|
||||||
if ((flags & RESULT_CONTAINS_TOP) != 0) {
|
if ((flags & RESULT_CONTAINS_TOP) != 0) {
|
||||||
// No use of scratch if allocation top is provided.
|
// No use of scratch if allocation top is provided.
|
||||||
ASSERT(scratch.is(no_reg));
|
ASSERT(!scratch.is_valid());
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Assert that result actually contains top on entry.
|
// Assert that result actually contains top on entry.
|
||||||
movq(kScratchRegister, new_space_allocation_top);
|
movq(kScratchRegister, new_space_allocation_top);
|
||||||
@ -2357,9 +2357,13 @@ void MacroAssembler::LoadAllocationTopHelper(Register result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move address of new object to result. Use scratch register if available.
|
// Move address of new object to result. Use scratch register if available.
|
||||||
if (scratch.is(no_reg)) {
|
if (!scratch.is_valid()) {
|
||||||
movq(kScratchRegister, new_space_allocation_top);
|
if (result.is(rax)) {
|
||||||
movq(result, Operand(kScratchRegister, 0));
|
load_rax(new_space_allocation_top);
|
||||||
|
} else {
|
||||||
|
movq(kScratchRegister, new_space_allocation_top);
|
||||||
|
movq(result, Operand(kScratchRegister, 0));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT(!scratch.is(result_end));
|
ASSERT(!scratch.is(result_end));
|
||||||
movq(scratch, new_space_allocation_top);
|
movq(scratch, new_space_allocation_top);
|
||||||
@ -2384,7 +2388,7 @@ void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
|
|||||||
store_rax(new_space_allocation_top);
|
store_rax(new_space_allocation_top);
|
||||||
} else {
|
} else {
|
||||||
// Register required - use scratch provided if available.
|
// Register required - use scratch provided if available.
|
||||||
if (scratch.is(no_reg)) {
|
if (!scratch.is_valid()) {
|
||||||
movq(kScratchRegister, new_space_allocation_top);
|
movq(kScratchRegister, new_space_allocation_top);
|
||||||
movq(Operand(kScratchRegister, 0), result_end);
|
movq(Operand(kScratchRegister, 0), result_end);
|
||||||
} else {
|
} else {
|
||||||
@ -2408,16 +2412,25 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
|
|||||||
// Calculate new top and bail out if new space is exhausted.
|
// Calculate new top and bail out if new space is exhausted.
|
||||||
ExternalReference new_space_allocation_limit =
|
ExternalReference new_space_allocation_limit =
|
||||||
ExternalReference::new_space_allocation_limit_address();
|
ExternalReference::new_space_allocation_limit_address();
|
||||||
lea(result_end, Operand(result, object_size));
|
|
||||||
|
Register top_reg = result_end.is_valid() ? result_end : result;
|
||||||
|
|
||||||
|
lea(top_reg, Operand(result, object_size));
|
||||||
movq(kScratchRegister, new_space_allocation_limit);
|
movq(kScratchRegister, new_space_allocation_limit);
|
||||||
cmpq(result_end, Operand(kScratchRegister, 0));
|
cmpq(top_reg, Operand(kScratchRegister, 0));
|
||||||
j(above, gc_required);
|
j(above, gc_required);
|
||||||
|
|
||||||
// Update allocation top.
|
// Update allocation top.
|
||||||
UpdateAllocationTopHelper(result_end, scratch);
|
UpdateAllocationTopHelper(top_reg, scratch);
|
||||||
|
|
||||||
// Tag the result if requested.
|
if (top_reg.is(result)) {
|
||||||
if ((flags & TAG_OBJECT) != 0) {
|
if ((flags & TAG_OBJECT) != 0) {
|
||||||
|
subq(result, Immediate(object_size - kHeapObjectTag));
|
||||||
|
} else {
|
||||||
|
subq(result, Immediate(object_size));
|
||||||
|
}
|
||||||
|
} else if ((flags & TAG_OBJECT) != 0) {
|
||||||
|
// Tag the result if requested.
|
||||||
addq(result, Immediate(kHeapObjectTag));
|
addq(result, Immediate(kHeapObjectTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,10 +778,17 @@ class MacroAssembler: public Assembler {
|
|||||||
void LeaveFrame(StackFrame::Type type);
|
void LeaveFrame(StackFrame::Type type);
|
||||||
|
|
||||||
// Allocation support helpers.
|
// Allocation support helpers.
|
||||||
|
// Loads the top of new-space into the result register.
|
||||||
|
// If flags contains RESULT_CONTAINS_TOP then result_end is valid and
|
||||||
|
// already contains the top of new-space, and scratch is invalid.
|
||||||
|
// Otherwise the address of the new-space top is loaded into scratch (if
|
||||||
|
// scratch is valid), and the new-space top is loaded into result.
|
||||||
void LoadAllocationTopHelper(Register result,
|
void LoadAllocationTopHelper(Register result,
|
||||||
Register result_end,
|
Register result_end,
|
||||||
Register scratch,
|
Register scratch,
|
||||||
AllocationFlags flags);
|
AllocationFlags flags);
|
||||||
|
// Update allocation top with value in result_end register.
|
||||||
|
// If scratch is valid, it contains the address of the allocation top.
|
||||||
void UpdateAllocationTopHelper(Register result_end, Register scratch);
|
void UpdateAllocationTopHelper(Register result_end, Register scratch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user