Commit 86dcdf3d authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce MakeSureDoubleAlignedHelper for x64 port.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/261233002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21662 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ba38bb57
...@@ -4325,6 +4325,41 @@ void MacroAssembler::LoadAllocationTopHelper(Register result, ...@@ -4325,6 +4325,41 @@ void MacroAssembler::LoadAllocationTopHelper(Register result,
} }
void MacroAssembler::MakeSureDoubleAlignedHelper(Register result,
Register scratch,
Label* gc_required,
AllocationFlags flags) {
if (kPointerSize == kDoubleSize) {
if (FLAG_debug_code) {
testl(result, Immediate(kDoubleAlignmentMask));
Check(zero, kAllocationIsNotDoubleAligned);
}
} else {
// Align the next allocation. Storing the filler map without checking top
// is safe in new-space because the limit of the heap is aligned there.
ASSERT(kPointerSize * 2 == kDoubleSize);
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
// Make sure scratch is not clobbered by this function as it might be
// used in UpdateAllocationTopHelper later.
ASSERT(!scratch.is(kScratchRegister));
Label aligned;
testl(result, Immediate(kDoubleAlignmentMask));
j(zero, &aligned, Label::kNear);
if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) {
ExternalReference allocation_limit =
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
cmpp(result, ExternalOperand(allocation_limit));
j(above_equal, gc_required);
}
LoadRoot(kScratchRegister, Heap::kOnePointerFillerMapRootIndex);
movp(Operand(result, 0), kScratchRegister);
addp(result, Immediate(kDoubleSize / 2));
bind(&aligned);
}
}
void MacroAssembler::UpdateAllocationTopHelper(Register result_end, void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
Register scratch, Register scratch,
AllocationFlags flags) { AllocationFlags flags) {
...@@ -4373,11 +4408,8 @@ void MacroAssembler::Allocate(int object_size, ...@@ -4373,11 +4408,8 @@ void MacroAssembler::Allocate(int object_size,
// Load address of new object into result. // Load address of new object into result.
LoadAllocationTopHelper(result, scratch, flags); LoadAllocationTopHelper(result, scratch, flags);
// Align the next allocation. Storing the filler map without checking top is if ((flags & DOUBLE_ALIGNMENT) != 0) {
// safe in new-space because the limit of the heap is aligned there. MakeSureDoubleAlignedHelper(result, scratch, gc_required, flags);
if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
testq(result, Immediate(kDoubleAlignmentMask));
Check(zero, kAllocationIsNotDoubleAligned);
} }
// Calculate new top and bail out if new space is exhausted. // Calculate new top and bail out if new space is exhausted.
...@@ -4452,11 +4484,8 @@ void MacroAssembler::Allocate(Register object_size, ...@@ -4452,11 +4484,8 @@ void MacroAssembler::Allocate(Register object_size,
// Load address of new object into result. // Load address of new object into result.
LoadAllocationTopHelper(result, scratch, flags); LoadAllocationTopHelper(result, scratch, flags);
// Align the next allocation. Storing the filler map without checking top is if ((flags & DOUBLE_ALIGNMENT) != 0) {
// safe in new-space because the limit of the heap is aligned there. MakeSureDoubleAlignedHelper(result, scratch, gc_required, flags);
if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
testq(result, Immediate(kDoubleAlignmentMask));
Check(zero, kAllocationIsNotDoubleAligned);
} }
// Calculate new top and bail out if new space is exhausted. // Calculate new top and bail out if new space is exhausted.
......
...@@ -1499,6 +1499,11 @@ class MacroAssembler: public Assembler { ...@@ -1499,6 +1499,11 @@ class MacroAssembler: public Assembler {
Register scratch, Register scratch,
AllocationFlags flags); AllocationFlags flags);
void MakeSureDoubleAlignedHelper(Register result,
Register scratch,
Label* gc_required,
AllocationFlags flags);
// Update allocation top with value in result_end register. // Update allocation top with value in result_end register.
// If scratch is valid, it contains the address of the allocation top. // If scratch is valid, it contains the address of the allocation top.
void UpdateAllocationTopHelper(Register result_end, void UpdateAllocationTopHelper(Register result_end,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment