Commit 2950df96 authored by bryleun's avatar bryleun Committed by Commit bot

S390: Get rid of AllocationFlags::TAG_OBJECT

Port 9bf7a31a

 Original commit message:

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

R=joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, bjaideep@ca.ibm.com

BUG=

Review-Url: https://codereview.chromium.org/1929673002
Cr-Commit-Position: refs/heads/master@{#35874}
parent 60497de2
......@@ -5255,7 +5255,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);
}
......
......@@ -1825,7 +1825,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate;
__ Allocate(JSIteratorResult::kSize, r2, r4, r5, &allocate, TAG_OBJECT);
__ Allocate(JSIteratorResult::kSize, r2, r4, r5, &allocate,
NO_ALLOCATION_FLAGS);
__ b(&done_allocate);
__ bind(&allocate);
......@@ -3098,7 +3099,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done;
__ Allocate(JSIteratorResult::kSize, r2, r4, r5, &runtime, TAG_OBJECT);
__ Allocate(JSIteratorResult::kSize, r2, r4, r5, &runtime,
NO_ALLOCATION_FLAGS);
__ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r3);
__ Pop(r4, r5);
__ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
......
......@@ -4626,15 +4626,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate);
// Initialize the JSObject fields.
__ StoreP(r4, MemOperand(r2, JSObject::kMapOffset));
__ StoreP(r4, FieldMemOperand(r2, JSObject::kMapOffset));
__ LoadRoot(r5, Heap::kEmptyFixedArrayRootIndex);
__ StoreP(r5, MemOperand(r2, JSObject::kPropertiesOffset));
__ StoreP(r5, MemOperand(r2, JSObject::kElementsOffset));
__ StoreP(r5, FieldMemOperand(r2, JSObject::kPropertiesOffset));
__ StoreP(r5, FieldMemOperand(r2, JSObject::kElementsOffset));
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ AddP(r3, r2, Operand(JSObject::kHeaderSize));
__ AddP(r3, r2, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e -------------
// -- r2 : result (untagged)
// -- r2 : result (tagged)
// -- r3 : result fields (untagged)
// -- r7 : result end (untagged)
// -- r4 : initial map
......@@ -4654,8 +4654,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
// Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(r3, r7, r8);
// Add the object tag to make the JSObject real.
__ AddP(r2, r2, Operand(kHeapObjectTag));
__ Ret();
}
__ bind(&slack_tracking);
......@@ -4675,9 +4673,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(r8, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(r3, r7, r8);
// Add the object tag to make the JSObject real.
__ AddP(r2, r2, Operand(kHeapObjectTag));
// Check if we can finalize the instance size.
__ CmpP(r9, Operand(Map::kSlackTrackingCounterEnd));
__ Ret(ne);
......@@ -4703,10 +4698,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(r4);
}
__ SubP(r2, r2, Operand(kHeapObjectTag));
__ LoadlB(r7, FieldMemOperand(r4, Map::kInstanceSizeOffset));
__ ShiftLeftP(r7, r7, Operand(kPointerSizeLog2));
__ AddP(r7, r2, r7);
__ SubP(r7, r7, Operand(kHeapObjectTag));
__ b(&done_allocate);
// Fall back to %NewObject.
......@@ -4771,7 +4766,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array.
Label allocate, done_allocate;
__ Allocate(JSArray::kSize, r2, r3, r4, &allocate, TAG_OBJECT);
__ Allocate(JSArray::kSize, r2, r3, r4, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the rest parameter array in r0.
......@@ -4814,7 +4809,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate;
__ mov(r3, Operand(JSArray::kSize + FixedArray::kHeaderSize));
__ AddP(r3, r3, r8);
__ Allocate(r3, r5, r6, r7, &allocate, TAG_OBJECT);
__ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the elements array in r5.
......@@ -4961,7 +4956,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ AddP(r1, r1, Operand(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go.
__ Allocate(r1, r2, r1, r6, &runtime, TAG_OBJECT);
__ Allocate(r1, r2, r1, r6, &runtime, NO_ALLOCATION_FLAGS);
// r2 = address of new object(s) (tagged)
// r4 = argument count (smi-tagged)
......@@ -5179,7 +5174,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate;
__ mov(r3, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
__ AddP(r3, r3, r8);
__ Allocate(r3, r5, r6, r7, &allocate, TAG_OBJECT);
__ Allocate(r3, r5, r6, r7, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate);
// Setup the elements array in r5.
......
......@@ -172,7 +172,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
__ SmiToDoubleArrayOffset(r14, length);
__ AddP(r14, Operand(FixedDoubleArray::kHeaderSize));
__ Allocate(r14, array, r9, scratch2, &gc_required, DOUBLE_ALIGNMENT);
__ SubP(array, array, Operand(kHeapObjectTag));
// Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex);
__ StoreP(length, MemOperand(array, FixedDoubleArray::kLengthOffset));
......@@ -302,12 +302,12 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ AddP(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));
__ AddP(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;
......
......@@ -1815,10 +1815,8 @@ void MacroAssembler::Allocate(int object_size, Register result,
}
StoreP(result_end, MemOperand(top_address));
// Tag object if requested.
if ((flags & TAG_OBJECT) != 0) {
AddP(result, result, Operand(kHeapObjectTag));
}
// Tag object.
AddP(result, result, Operand(kHeapObjectTag));
}
void MacroAssembler::Allocate(Register object_size, Register result,
......@@ -1915,10 +1913,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
}
StoreP(result_end, MemOperand(top_address));
// Tag object if requested.
if ((flags & TAG_OBJECT) != 0) {
AddP(result, result, Operand(kHeapObjectTag));
}
// Tag object.
AddP(result, result, Operand(kHeapObjectTag));
}
void MacroAssembler::AllocateTwoByteString(Register result, Register length,
......@@ -1935,7 +1931,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, Register length,
AndP(scratch1, Operand(~kObjectAlignmentMask));
// 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,
......@@ -1955,7 +1952,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
AndP(scratch1, Operand(~kObjectAlignmentMask));
// 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,
......@@ -1967,7 +1965,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);
......@@ -1978,7 +1976,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);
......@@ -1990,7 +1988,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);
......@@ -2002,7 +2000,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);
......@@ -2969,12 +2967,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
......@@ -2982,11 +2979,7 @@ 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));
} else {
StoreP(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
}
}
void MacroAssembler::AllocateHeapNumberWithValue(
......@@ -3005,7 +2998,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);
......
......@@ -983,7 +983,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,
......
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