PPC: Get rid of AllocationFlags::TAG_OBJECT

Port ef49c6b11a

Original commit message:

    Default (and only way) is now to retrieve a tagged object.

R=mlippautz@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=chromium:606711
LOG=N

Review-Url: https://codereview.chromium.org/1917353002
Cr-Commit-Position: refs/heads/master@{#35829}
This commit is contained in:
bjaideep 2016-04-27 10:09:08 -07:00 committed by Commit bot
parent fec99c689b
commit 9bf7a31a8c
6 changed files with 37 additions and 47 deletions

View File

@ -5360,7 +5360,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
Register scratch2 = ToRegister(instr->temp2());
// Allocate memory for the object.
AllocationFlags flags = TAG_OBJECT;
AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
}

View File

@ -1869,7 +1869,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate;
__ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate, TAG_OBJECT);
__ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate,
NO_ALLOCATION_FLAGS);
__ b(&done_allocate);
__ bind(&allocate);
@ -3181,7 +3182,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done;
__ Allocate(JSIteratorResult::kSize, r3, r5, r6, &runtime, TAG_OBJECT);
__ Allocate(JSIteratorResult::kSize, r3, r5, r6, &runtime,
NO_ALLOCATION_FLAGS);
__ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r4);
__ Pop(r5, r6);
__ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex);

View File

@ -4698,15 +4698,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate);
// Initialize the JSObject fields.
__ StoreP(r5, MemOperand(r3, JSObject::kMapOffset));
__ StoreP(r5, FieldMemOperand(r3, JSObject::kMapOffset), r0);
__ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
__ StoreP(r6, MemOperand(r3, JSObject::kPropertiesOffset));
__ StoreP(r6, MemOperand(r3, JSObject::kElementsOffset));
__ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0);
__ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0);
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ addi(r4, r3, Operand(JSObject::kHeaderSize));
__ addi(r4, r3, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e -------------
// -- r3 : result (untagged)
// -- r3 : result (tagged)
// -- r4 : result fields (untagged)
// -- r8 : result end (untagged)
// -- r5 : initial map
@ -4724,9 +4724,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{
// Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(r4, r8, r9);
// Add the object tag to make the JSObject real.
__ addi(r3, r3, Operand(kHeapObjectTag));
__ Ret();
}
__ bind(&slack_tracking);
@ -4746,9 +4743,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(r4, r8, r9);
// Add the object tag to make the JSObject real.
__ addi(r3, r3, Operand(kHeapObjectTag));
// Check if we can finalize the instance size.
__ cmpi(r10, Operand(Map::kSlackTrackingCounterEnd));
__ Ret(ne);
@ -4774,10 +4768,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(r5);
}
__ subi(r3, r3, Operand(kHeapObjectTag));
__ lbz(r8, FieldMemOperand(r5, Map::kInstanceSizeOffset));
__ ShiftLeftImm(r8, r8, Operand(kPointerSizeLog2));
__ add(r8, r3, r8);
__ subi(r8, r8, Operand(kHeapObjectTag));
__ b(&done_allocate);
// Fall back to %NewObject.
@ -4842,7 +4836,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array.
Label allocate, done_allocate;
__ Allocate(JSArray::kSize, r3, r4, r5, &allocate, TAG_OBJECT);
__ Allocate(JSArray::kSize, r3, r4, r5, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the rest parameter array in r0.
@ -4885,7 +4879,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate;
__ mov(r4, Operand(JSArray::kSize + FixedArray::kHeaderSize));
__ add(r4, r4, r9);
__ Allocate(r4, r6, r7, r8, &allocate, TAG_OBJECT);
__ Allocate(r4, r6, r7, r8, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the elements array in r6.
@ -5040,7 +5034,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ addi(r11, r11, Operand(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go.
__ Allocate(r11, r3, r11, r7, &runtime, TAG_OBJECT);
__ Allocate(r11, r3, r11, r7, &runtime, NO_ALLOCATION_FLAGS);
// r3 = address of new object(s) (tagged)
// r5 = argument count (smi-tagged)
@ -5264,7 +5258,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate;
__ mov(r4, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
__ add(r4, r4, r9);
__ Allocate(r4, r6, r7, r8, &allocate, TAG_OBJECT);
__ Allocate(r4, r6, r7, r8, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the elements array in r6.

View File

@ -185,6 +185,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
__ SmiToDoubleArrayOffset(scratch3, length);
__ addi(scratch3, scratch3, Operand(FixedDoubleArray::kHeaderSize));
__ Allocate(scratch3, array, scratch4, scratch2, fail, DOUBLE_ALIGNMENT);
__ subi(array, array, Operand(kHeapObjectTag));
// array: destination FixedDoubleArray, not tagged as heap object.
// elements: source FixedArray.
@ -313,12 +314,12 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ add(array_size, array_size, r0);
__ Allocate(array_size, array, allocate_scratch, scratch, &gc_required,
NO_ALLOCATION_FLAGS);
// array: destination FixedArray, not tagged as heap object
// array: destination FixedArray, tagged as heap object
// Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
__ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset));
__ StoreP(scratch, MemOperand(array, HeapObject::kMapOffset));
__ addi(array, array, Operand(kHeapObjectTag));
__ StoreP(length, FieldMemOperand(array,
FixedDoubleArray::kLengthOffset), r0);
__ StoreP(scratch, FieldMemOperand(array, HeapObject::kMapOffset), r0);
// Prepare for conversion loop.
Register src_elements = elements;

View File

@ -1877,10 +1877,8 @@ void MacroAssembler::Allocate(int object_size, Register result,
}
StoreP(result_end, MemOperand(top_address));
// Tag object if requested.
if ((flags & TAG_OBJECT) != 0) {
addi(result, result, Operand(kHeapObjectTag));
}
// Tag object.
addi(result, result, Operand(kHeapObjectTag));
}
@ -1978,10 +1976,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
}
StoreP(result_end, MemOperand(top_address));
// Tag object if requested.
if ((flags & TAG_OBJECT) != 0) {
addi(result, result, Operand(kHeapObjectTag));
}
// Tag object.
addi(result, result, Operand(kHeapObjectTag));
}
@ -1999,7 +1995,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, Register length,
and_(scratch1, scratch1, r0);
// Allocate two-byte string in new space.
Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT);
Allocate(scratch1, result, scratch2, scratch3, gc_required,
NO_ALLOCATION_FLAGS);
// Set the map, length and hash field.
InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1,
@ -2021,7 +2018,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
and_(scratch1, scratch1, r0);
// Allocate one-byte string in new space.
Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT);
Allocate(scratch1, result, scratch2, scratch3, gc_required,
NO_ALLOCATION_FLAGS);
// Set the map, length and hash field.
InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
@ -2034,7 +2032,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Register length,
Register scratch2,
Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT);
NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kConsStringMapRootIndex, scratch1,
scratch2);
@ -2046,7 +2044,7 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
Register scratch2,
Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT);
NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
scratch1, scratch2);
@ -2059,7 +2057,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Register scratch2,
Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT);
NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedStringMapRootIndex, scratch1,
scratch2);
@ -2072,7 +2070,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Register scratch2,
Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT);
NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
scratch1, scratch2);
@ -3099,12 +3097,11 @@ void MacroAssembler::AllocateHeapNumber(Register result, Register scratch1,
Register scratch2,
Register heap_number_map,
Label* gc_required,
TaggingMode tagging_mode,
MutableMode mode) {
// Allocate an object in the heap for the heap number and tag it as a heap
// object.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required,
tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS);
NO_ALLOCATION_FLAGS);
Heap::RootListIndex map_index = mode == MUTABLE
? Heap::kMutableHeapNumberMapRootIndex
@ -3112,12 +3109,8 @@ void MacroAssembler::AllocateHeapNumber(Register result, Register scratch1,
AssertIsRoot(heap_number_map, map_index);
// Store heap number map in the allocated object.
if (tagging_mode == TAG_RESULT) {
StoreP(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset),
r0);
} else {
StoreP(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
}
StoreP(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset),
r0);
}
@ -3138,7 +3131,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value));
// Allocate JSValue in new space.
Allocate(JSValue::kSize, result, scratch1, scratch2, gc_required, TAG_OBJECT);
Allocate(JSValue::kSize, result, scratch1, scratch2, gc_required,
NO_ALLOCATION_FLAGS);
// Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);

View File

@ -719,7 +719,6 @@ class MacroAssembler : public Assembler {
// when control continues at the gc_required label.
void AllocateHeapNumber(Register result, Register scratch1, Register scratch2,
Register heap_number_map, Label* gc_required,
TaggingMode tagging_mode = TAG_RESULT,
MutableMode mode = IMMUTABLE);
void AllocateHeapNumberWithValue(Register result, DoubleRegister value,
Register scratch1, Register scratch2,