Generalizing remaining Allocate functions in the macro assemblers used in pretenuring.
BUG= Review URL: https://codereview.chromium.org/12440041 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14065 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
dfd9ea8087
commit
8792cac5cc
@ -221,8 +221,7 @@ static void AllocateJSArray(MacroAssembler* masm,
|
||||
__ add(elements_array_end,
|
||||
elements_array_end,
|
||||
Operand(array_size, ASR, kSmiTagSize));
|
||||
__ AllocateInNewSpace(
|
||||
elements_array_end,
|
||||
__ Allocate(elements_array_end,
|
||||
result,
|
||||
scratch1,
|
||||
scratch2,
|
||||
@ -874,7 +873,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
// r1: constructor function
|
||||
// r2: initial map
|
||||
__ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset));
|
||||
__ AllocateInNewSpace(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS);
|
||||
__ Allocate(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS);
|
||||
|
||||
// Allocated the JSObject, now initialize the fields. Map is set to
|
||||
// initial map and properties and elements are set to empty fixed array.
|
||||
@ -949,7 +948,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
// r4: JSObject
|
||||
// r5: start of next object
|
||||
__ add(r0, r3, Operand(FixedArray::kHeaderSize / kPointerSize));
|
||||
__ AllocateInNewSpace(
|
||||
__ Allocate(
|
||||
r0,
|
||||
r5,
|
||||
r6,
|
||||
|
@ -4791,7 +4791,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ add(r9, r9, Operand(Heap::kArgumentsObjectSize));
|
||||
|
||||
// Do the allocation of all three objects in one go.
|
||||
__ AllocateInNewSpace(r9, r0, r3, r4, &runtime, TAG_OBJECT);
|
||||
__ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT);
|
||||
|
||||
// r0 = address of new object(s) (tagged)
|
||||
// r2 = argument count (tagged)
|
||||
@ -4967,13 +4967,8 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
|
||||
__ add(r1, r1, Operand(Heap::kArgumentsObjectSizeStrict / kPointerSize));
|
||||
|
||||
// Do the allocation of both objects in one go.
|
||||
__ AllocateInNewSpace(r1,
|
||||
r0,
|
||||
r2,
|
||||
r3,
|
||||
&runtime,
|
||||
static_cast<AllocationFlags>(TAG_OBJECT |
|
||||
SIZE_IN_WORDS));
|
||||
__ Allocate(r1, r0, r2, r3, &runtime,
|
||||
static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS));
|
||||
|
||||
// Get the arguments boilerplate from the current native context.
|
||||
__ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
||||
@ -5477,7 +5472,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
|
||||
(JSRegExpResult::kSize + FixedArray::kHeaderSize) / kPointerSize;
|
||||
__ mov(r5, Operand(r1, LSR, kSmiTagSize + kSmiShiftSize));
|
||||
__ add(r2, r5, Operand(objects_size));
|
||||
__ AllocateInNewSpace(
|
||||
__ Allocate(
|
||||
r2, // In: Size, in words.
|
||||
r0, // Out: Start of allocation (tagged).
|
||||
r3, // Scratch register.
|
||||
|
@ -207,7 +207,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
||||
// Use lr as a temporary register.
|
||||
__ mov(lr, Operand(r5, LSL, 2));
|
||||
__ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize));
|
||||
__ AllocateInNewSpace(lr, r6, r7, r9, &gc_required, DOUBLE_ALIGNMENT);
|
||||
__ Allocate(lr, r6, r7, r9, &gc_required, DOUBLE_ALIGNMENT);
|
||||
// r6: destination FixedDoubleArray, not tagged as heap object.
|
||||
|
||||
// Set destination FixedDoubleArray's length and map.
|
||||
@ -348,7 +348,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
||||
// Allocate new FixedArray.
|
||||
__ mov(r0, Operand(FixedDoubleArray::kHeaderSize));
|
||||
__ add(r0, r0, Operand(r5, LSL, 1));
|
||||
__ AllocateInNewSpace(r0, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS);
|
||||
__ Allocate(r0, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS);
|
||||
// r6: destination FixedArray, not tagged as heap object
|
||||
// Set destination FixedDoubleArray's length and map.
|
||||
__ LoadRoot(r9, Heap::kFixedArrayMapRootIndex);
|
||||
|
@ -5677,7 +5677,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
|
||||
__ Allocate(size, result, scratch, scratch2, deferred->entry(), flags);
|
||||
} else {
|
||||
Register size = ToRegister(instr->size());
|
||||
__ AllocateInNewSpace(size,
|
||||
__ Allocate(size,
|
||||
result,
|
||||
scratch,
|
||||
scratch2,
|
||||
|
@ -1671,13 +1671,12 @@ void MacroAssembler::Allocate(int object_size,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
void MacroAssembler::Allocate(Register object_size,
|
||||
Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -1703,20 +1702,20 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
// The values must be adjacent in memory to allow the use of LDM.
|
||||
// Also, assert that the registers are numbered such that the values
|
||||
// are loaded in the correct order.
|
||||
ExternalReference new_space_allocation_top =
|
||||
ExternalReference::new_space_allocation_top_address(isolate());
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
ExternalReference allocation_top =
|
||||
AllocationUtils::GetAllocationTopReference(isolate(), flags);
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
intptr_t top =
|
||||
reinterpret_cast<intptr_t>(new_space_allocation_top.address());
|
||||
reinterpret_cast<intptr_t>(allocation_top.address());
|
||||
intptr_t limit =
|
||||
reinterpret_cast<intptr_t>(new_space_allocation_limit.address());
|
||||
reinterpret_cast<intptr_t>(allocation_limit.address());
|
||||
ASSERT((limit - top) == kPointerSize);
|
||||
ASSERT(result.code() < ip.code());
|
||||
|
||||
// Set up allocation top address.
|
||||
Register topaddr = scratch1;
|
||||
mov(topaddr, Operand(new_space_allocation_top));
|
||||
mov(topaddr, Operand(allocation_top));
|
||||
|
||||
// This code stores a temporary value in ip. This is OK, as the code below
|
||||
// does not need ip for implicit literal generation.
|
||||
@ -1739,6 +1738,7 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
if ((flags & DOUBLE_ALIGNMENT) != 0) {
|
||||
// Align the next allocation. Storing the filler map without checking top is
|
||||
// always safe because the limit of the heap is always aligned.
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
|
||||
and_(scratch2, result, Operand(kDoubleAlignmentMask), SetCC);
|
||||
Label aligned;
|
||||
@ -1809,7 +1809,7 @@ void MacroAssembler::AllocateTwoByteString(Register result,
|
||||
and_(scratch1, scratch1, Operand(~kObjectAlignmentMask));
|
||||
|
||||
// Allocate two-byte string in new space.
|
||||
AllocateInNewSpace(scratch1,
|
||||
Allocate(scratch1,
|
||||
result,
|
||||
scratch2,
|
||||
scratch3,
|
||||
@ -1840,7 +1840,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
|
||||
and_(scratch1, scratch1, Operand(~kObjectAlignmentMask));
|
||||
|
||||
// Allocate ASCII string in new space.
|
||||
AllocateInNewSpace(scratch1,
|
||||
Allocate(scratch1,
|
||||
result,
|
||||
scratch2,
|
||||
scratch3,
|
||||
|
@ -679,7 +679,7 @@ class MacroAssembler: public Assembler {
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(Register object_size,
|
||||
void Allocate(Register object_size,
|
||||
Register result,
|
||||
Register scratch1,
|
||||
Register scratch2,
|
||||
|
@ -2995,7 +2995,7 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
||||
__ cmp(r3, Operand(instance_size >> kPointerSizeLog2));
|
||||
__ Check(eq, "Instance size of initial map changed.");
|
||||
#endif
|
||||
__ AllocateInNewSpace(r3, r4, r5, r6, &generic_stub_call, SIZE_IN_WORDS);
|
||||
__ Allocate(r3, r4, r5, r6, &generic_stub_call, SIZE_IN_WORDS);
|
||||
|
||||
// Allocated the JSObject, now initialize the fields. Map is set to initial
|
||||
// map and properties and elements are set to empty fixed array.
|
||||
|
@ -216,8 +216,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
// eax: initial map
|
||||
__ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset));
|
||||
__ shl(edi, kPointerSizeLog2);
|
||||
__ AllocateInNewSpace(
|
||||
edi, ebx, edi, no_reg, &rt_call, NO_ALLOCATION_FLAGS);
|
||||
__ Allocate(edi, ebx, edi, no_reg, &rt_call, NO_ALLOCATION_FLAGS);
|
||||
// Allocated the JSObject, now initialize the fields.
|
||||
// eax: initial map
|
||||
// ebx: JSObject
|
||||
@ -280,7 +279,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
// ebx: JSObject
|
||||
// edi: start of next object (will be start of FixedArray)
|
||||
// edx: number of elements in properties array
|
||||
__ AllocateInNewSpace(FixedArray::kHeaderSize,
|
||||
__ Allocate(FixedArray::kHeaderSize,
|
||||
times_pointer_size,
|
||||
edx,
|
||||
REGISTER_VALUE_IS_INT32,
|
||||
@ -1125,7 +1124,7 @@ static void AllocateJSArray(MacroAssembler* masm,
|
||||
// Allocate the JSArray object together with space for a FixedArray with the
|
||||
// requested elements.
|
||||
STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
|
||||
__ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize,
|
||||
__ Allocate(JSArray::kSize + FixedArray::kHeaderSize,
|
||||
times_pointer_size,
|
||||
array_size,
|
||||
REGISTER_VALUE_IS_SMI,
|
||||
|
@ -3577,7 +3577,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ add(ebx, Immediate(Heap::kArgumentsObjectSize));
|
||||
|
||||
// Do the allocation of all three objects in one go.
|
||||
__ AllocateInNewSpace(ebx, eax, edx, edi, &runtime, TAG_OBJECT);
|
||||
__ Allocate(ebx, eax, edx, edi, &runtime, TAG_OBJECT);
|
||||
|
||||
// eax = address of new object(s) (tagged)
|
||||
// ecx = argument count (tagged)
|
||||
@ -3775,7 +3775,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
|
||||
__ add(ecx, Immediate(Heap::kArgumentsObjectSizeStrict));
|
||||
|
||||
// Do the allocation of both objects in one go.
|
||||
__ AllocateInNewSpace(ecx, eax, edx, ebx, &runtime, TAG_OBJECT);
|
||||
__ Allocate(ecx, eax, edx, ebx, &runtime, TAG_OBJECT);
|
||||
|
||||
// Get the arguments boilerplate from the current native context.
|
||||
__ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
||||
@ -4299,7 +4299,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
|
||||
// Allocate RegExpResult followed by FixedArray with size in ebx.
|
||||
// JSArray: [Map][empty properties][Elements][Length-smi][index][input]
|
||||
// Elements: [Map][Length][..elements..]
|
||||
__ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize,
|
||||
__ Allocate(JSRegExpResult::kSize + FixedArray::kHeaderSize,
|
||||
times_pointer_size,
|
||||
ebx, // In: Number of elements as a smi
|
||||
REGISTER_VALUE_IS_SMI,
|
||||
|
@ -450,9 +450,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
||||
// edi: length of source FixedArray (smi-tagged)
|
||||
AllocationFlags flags =
|
||||
static_cast<AllocationFlags>(TAG_OBJECT | DOUBLE_ALIGNMENT);
|
||||
__ AllocateInNewSpace(FixedDoubleArray::kHeaderSize, times_8,
|
||||
edi, REGISTER_VALUE_IS_SMI,
|
||||
eax, ebx, no_reg, &gc_required, flags);
|
||||
__ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi,
|
||||
REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags);
|
||||
|
||||
// eax: destination FixedDoubleArray
|
||||
// edi: number of elements
|
||||
@ -589,7 +588,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
||||
// Allocate new FixedArray.
|
||||
// ebx: length of source FixedDoubleArray (smi-tagged)
|
||||
__ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize));
|
||||
__ AllocateInNewSpace(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT);
|
||||
__ Allocate(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT);
|
||||
|
||||
// eax: destination FixedArray
|
||||
// ebx: number of elements
|
||||
|
@ -5572,7 +5572,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
|
||||
__ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
} else {
|
||||
Register size = ToRegister(instr->size());
|
||||
__ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
__ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
}
|
||||
|
||||
__ bind(deferred->exit());
|
||||
|
@ -1332,8 +1332,7 @@ void MacroAssembler::Allocate(int object_size,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(
|
||||
int header_size,
|
||||
void MacroAssembler::Allocate(int header_size,
|
||||
ScaleFactor element_size,
|
||||
Register element_count,
|
||||
RegisterValueType element_count_type,
|
||||
@ -1343,7 +1342,6 @@ void MacroAssembler::AllocateInNewSpace(
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & SIZE_IN_WORDS) == 0);
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -1365,6 +1363,7 @@ void MacroAssembler::AllocateInNewSpace(
|
||||
// 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) {
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
|
||||
Label aligned;
|
||||
test(result, Immediate(kDoubleAlignmentMask));
|
||||
@ -1375,9 +1374,9 @@ void MacroAssembler::AllocateInNewSpace(
|
||||
bind(&aligned);
|
||||
}
|
||||
|
||||
// Calculate new top and bail out if new space is exhausted.
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
// Calculate new top and bail out if space is exhausted.
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
|
||||
// We assume that element_count*element_size + header_size does not
|
||||
// overflow.
|
||||
@ -1394,7 +1393,7 @@ void MacroAssembler::AllocateInNewSpace(
|
||||
lea(result_end, Operand(element_count, element_size, header_size));
|
||||
add(result_end, result);
|
||||
j(carry, gc_required);
|
||||
cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
|
||||
cmp(result_end, Operand::StaticVariable(allocation_limit));
|
||||
j(above, gc_required);
|
||||
|
||||
if ((flags & TAG_OBJECT) != 0) {
|
||||
@ -1407,14 +1406,13 @@ void MacroAssembler::AllocateInNewSpace(
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
void MacroAssembler::Allocate(Register object_size,
|
||||
Register result,
|
||||
Register result_end,
|
||||
Register scratch,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -1436,6 +1434,7 @@ void MacroAssembler::AllocateInNewSpace(Register 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) {
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
|
||||
Label aligned;
|
||||
test(result, Immediate(kDoubleAlignmentMask));
|
||||
@ -1446,15 +1445,16 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
bind(&aligned);
|
||||
}
|
||||
|
||||
// Calculate new top and bail out if new space is exhausted.
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
// Calculate new top and bail out if space is exhausted.
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
|
||||
if (!object_size.is(result_end)) {
|
||||
mov(result_end, object_size);
|
||||
}
|
||||
add(result_end, result);
|
||||
j(carry, gc_required);
|
||||
cmp(result_end, Operand::StaticVariable(new_space_allocation_limit));
|
||||
cmp(result_end, Operand::StaticVariable(allocation_limit));
|
||||
j(above, gc_required);
|
||||
|
||||
// Tag result if requested.
|
||||
@ -1511,7 +1511,7 @@ void MacroAssembler::AllocateTwoByteString(Register result,
|
||||
and_(scratch1, Immediate(~kObjectAlignmentMask));
|
||||
|
||||
// Allocate two byte string in new space.
|
||||
AllocateInNewSpace(SeqTwoByteString::kHeaderSize,
|
||||
Allocate(SeqTwoByteString::kHeaderSize,
|
||||
times_1,
|
||||
scratch1,
|
||||
REGISTER_VALUE_IS_INT32,
|
||||
@ -1547,7 +1547,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
|
||||
and_(scratch1, Immediate(~kObjectAlignmentMask));
|
||||
|
||||
// Allocate ASCII string in new space.
|
||||
AllocateInNewSpace(SeqOneByteString::kHeaderSize,
|
||||
Allocate(SeqOneByteString::kHeaderSize,
|
||||
times_1,
|
||||
scratch1,
|
||||
REGISTER_VALUE_IS_INT32,
|
||||
|
@ -582,7 +582,7 @@ class MacroAssembler: public Assembler {
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(int header_size,
|
||||
void Allocate(int header_size,
|
||||
ScaleFactor element_size,
|
||||
Register element_count,
|
||||
RegisterValueType element_count_type,
|
||||
@ -592,7 +592,7 @@ class MacroAssembler: public Assembler {
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(Register object_size,
|
||||
void Allocate(Register object_size,
|
||||
Register result,
|
||||
Register result_end,
|
||||
Register scratch,
|
||||
|
@ -220,7 +220,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
__ movzxbq(rdi, FieldOperand(rax, Map::kInstanceSizeOffset));
|
||||
__ shl(rdi, Immediate(kPointerSizeLog2));
|
||||
// rdi: size of new object
|
||||
__ AllocateInNewSpace(rdi,
|
||||
__ Allocate(rdi,
|
||||
rbx,
|
||||
rdi,
|
||||
no_reg,
|
||||
@ -287,7 +287,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
|
||||
// rbx: JSObject
|
||||
// rdi: start of next object (will be start of FixedArray)
|
||||
// rdx: number of elements in properties array
|
||||
__ AllocateInNewSpace(FixedArray::kHeaderSize,
|
||||
__ Allocate(FixedArray::kHeaderSize,
|
||||
times_pointer_size,
|
||||
rdx,
|
||||
rdi,
|
||||
@ -1212,7 +1212,7 @@ static void AllocateJSArray(MacroAssembler* masm,
|
||||
// requested elements.
|
||||
SmiIndex index =
|
||||
masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2);
|
||||
__ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize,
|
||||
__ Allocate(JSArray::kSize + FixedArray::kHeaderSize,
|
||||
index.scale,
|
||||
index.reg,
|
||||
result,
|
||||
|
@ -2663,7 +2663,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ addq(r8, Immediate(Heap::kArgumentsObjectSize));
|
||||
|
||||
// Do the allocation of all three objects in one go.
|
||||
__ AllocateInNewSpace(r8, rax, rdx, rdi, &runtime, TAG_OBJECT);
|
||||
__ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT);
|
||||
|
||||
// rax = address of new object(s) (tagged)
|
||||
// rcx = argument count (untagged)
|
||||
@ -2881,7 +2881,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
|
||||
__ addq(rcx, Immediate(Heap::kArgumentsObjectSizeStrict));
|
||||
|
||||
// Do the allocation of both objects in one go.
|
||||
__ AllocateInNewSpace(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT);
|
||||
__ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT);
|
||||
|
||||
// Get the arguments boilerplate from the current native context.
|
||||
__ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
||||
@ -3414,7 +3414,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
|
||||
// Allocate RegExpResult followed by FixedArray with size in rbx.
|
||||
// JSArray: [Map][empty properties][Elements][Length-smi][index][input]
|
||||
// Elements: [Map][Length][..elements..]
|
||||
__ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize,
|
||||
__ Allocate(JSRegExpResult::kSize + FixedArray::kHeaderSize,
|
||||
times_pointer_size,
|
||||
rbx, // In: Number of elements.
|
||||
rax, // Out: Start of allocation (tagged).
|
||||
|
@ -347,7 +347,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
||||
// Allocate new backing store.
|
||||
__ bind(&new_backing_store);
|
||||
__ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize));
|
||||
__ AllocateInNewSpace(rdi, r14, r11, r15, fail, TAG_OBJECT);
|
||||
__ Allocate(rdi, r14, r11, r15, fail, TAG_OBJECT);
|
||||
// Set backing store's map
|
||||
__ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex);
|
||||
__ movq(FieldOperand(r14, HeapObject::kMapOffset), rdi);
|
||||
@ -435,7 +435,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
||||
// r8 : source FixedDoubleArray
|
||||
// r9 : number of elements
|
||||
__ lea(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize));
|
||||
__ AllocateInNewSpace(rdi, r11, r14, r15, &gc_required, TAG_OBJECT);
|
||||
__ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT);
|
||||
// r11: destination FixedArray
|
||||
__ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex);
|
||||
__ movq(FieldOperand(r11, HeapObject::kMapOffset), rdi);
|
||||
|
@ -5129,7 +5129,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
|
||||
__ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
} else {
|
||||
Register size = ToRegister(instr->size());
|
||||
__ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
__ Allocate(size, result, temp, no_reg, deferred->entry(), flags);
|
||||
}
|
||||
|
||||
__ bind(deferred->exit());
|
||||
|
@ -3830,7 +3830,7 @@ void MacroAssembler::Allocate(int object_size,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(int header_size,
|
||||
void MacroAssembler::Allocate(int header_size,
|
||||
ScaleFactor element_size,
|
||||
Register element_count,
|
||||
Register result,
|
||||
@ -3839,7 +3839,6 @@ void MacroAssembler::AllocateInNewSpace(int header_size,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & SIZE_IN_WORDS) == 0);
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -3866,15 +3865,15 @@ void MacroAssembler::AllocateInNewSpace(int header_size,
|
||||
}
|
||||
|
||||
// Calculate new top and bail out if new space is exhausted.
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
|
||||
// We assume that element_count*element_size + header_size does not
|
||||
// overflow.
|
||||
lea(result_end, Operand(element_count, element_size, header_size));
|
||||
addq(result_end, result);
|
||||
j(carry, gc_required);
|
||||
Operand limit_operand = ExternalOperand(new_space_allocation_limit);
|
||||
Operand limit_operand = ExternalOperand(allocation_limit);
|
||||
cmpq(result_end, limit_operand);
|
||||
j(above, gc_required);
|
||||
|
||||
@ -3889,14 +3888,13 @@ void MacroAssembler::AllocateInNewSpace(int header_size,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
void MacroAssembler::Allocate(Register object_size,
|
||||
Register result,
|
||||
Register result_end,
|
||||
Register scratch,
|
||||
Label* gc_required,
|
||||
AllocationFlags flags) {
|
||||
ASSERT((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
|
||||
ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
|
||||
if (!FLAG_inline_new) {
|
||||
if (emit_debug_code()) {
|
||||
// Trash the registers to simulate an allocation failure.
|
||||
@ -3916,14 +3914,14 @@ void MacroAssembler::AllocateInNewSpace(Register object_size,
|
||||
LoadAllocationTopHelper(result, scratch, flags);
|
||||
|
||||
// Calculate new top and bail out if new space is exhausted.
|
||||
ExternalReference new_space_allocation_limit =
|
||||
ExternalReference::new_space_allocation_limit_address(isolate());
|
||||
ExternalReference allocation_limit =
|
||||
AllocationUtils::GetAllocationLimitReference(isolate(), flags);
|
||||
if (!object_size.is(result_end)) {
|
||||
movq(result_end, object_size);
|
||||
}
|
||||
addq(result_end, result);
|
||||
j(carry, gc_required);
|
||||
Operand limit_operand = ExternalOperand(new_space_allocation_limit);
|
||||
Operand limit_operand = ExternalOperand(allocation_limit);
|
||||
cmpq(result_end, limit_operand);
|
||||
j(above, gc_required);
|
||||
|
||||
@ -3991,7 +3989,7 @@ void MacroAssembler::AllocateTwoByteString(Register result,
|
||||
}
|
||||
|
||||
// Allocate two byte string in new space.
|
||||
AllocateInNewSpace(SeqTwoByteString::kHeaderSize,
|
||||
Allocate(SeqTwoByteString::kHeaderSize,
|
||||
times_1,
|
||||
scratch1,
|
||||
result,
|
||||
@ -4029,7 +4027,7 @@ void MacroAssembler::AllocateAsciiString(Register result,
|
||||
}
|
||||
|
||||
// Allocate ASCII string in new space.
|
||||
AllocateInNewSpace(SeqOneByteString::kHeaderSize,
|
||||
Allocate(SeqOneByteString::kHeaderSize,
|
||||
times_1,
|
||||
scratch1,
|
||||
result,
|
||||
|
@ -1042,7 +1042,7 @@ class MacroAssembler: public Assembler {
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(int header_size,
|
||||
void Allocate(int header_size,
|
||||
ScaleFactor element_size,
|
||||
Register element_count,
|
||||
Register result,
|
||||
@ -1051,7 +1051,7 @@ class MacroAssembler: public Assembler {
|
||||
Label* gc_required,
|
||||
AllocationFlags flags);
|
||||
|
||||
void AllocateInNewSpace(Register object_size,
|
||||
void Allocate(Register object_size,
|
||||
Register result,
|
||||
Register result_end,
|
||||
Register scratch,
|
||||
|
Loading…
Reference in New Issue
Block a user