diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 8779921ac9..0fe2b63a96 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -4558,15 +4558,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ str(r2, MemOperand(r0, JSObject::kMapOffset)); + __ str(r2, FieldMemOperand(r0, JSObject::kMapOffset)); __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); - __ str(r3, MemOperand(r0, JSObject::kPropertiesOffset)); - __ str(r3, MemOperand(r0, JSObject::kElementsOffset)); + __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); + __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ add(r1, r0, Operand(JSObject::kHeaderSize)); + __ add(r1, r0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); // ----------- S t a t e ------------- - // -- r0 : result (untagged) + // -- r0 : result (tagged) // -- r1 : result fields (untagged) // -- r5 : result end (untagged) // -- r2 : initial map @@ -4584,10 +4584,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { { // Initialize all in-object fields with undefined. __ InitializeFieldsWithFiller(r1, r5, r6); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ add(r0, r0, Operand(kHeapObjectTag)); __ Ret(); } __ bind(&slack_tracking); @@ -4606,10 +4602,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex); __ InitializeFieldsWithFiller(r1, r5, r6); - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ add(r0, r0, Operand(kHeapObjectTag)); - // Check if we can finalize the instance size. STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); __ tst(r3, Operand(Map::ConstructionCounter::kMask)); @@ -4636,10 +4628,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(r2); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ sub(r0, r0, Operand(kHeapObjectTag)); __ ldrb(r5, FieldMemOperand(r2, Map::kInstanceSizeOffset)); __ add(r5, r0, Operand(r5, LSL, kPointerSizeLog2)); + STATIC_ASSERT(kHeapObjectTag == 1); + __ sub(r5, r5, Operand(kHeapObjectTag)); __ b(&done_allocate); // Fall back to %NewObject. @@ -4702,7 +4694,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, r0, r1, r2, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, r0, r1, r2, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in r0. @@ -4744,7 +4736,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ mov(r1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ add(r1, r1, Operand(r0, LSL, kPointerSizeLog2 - 1)); - __ Allocate(r1, r3, r4, r5, &allocate, TAG_OBJECT); + __ Allocate(r1, r3, r4, r5, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in r3. @@ -4876,7 +4868,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ add(r9, r9, Operand(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(r9, r0, r9, r4, &runtime, TAG_OBJECT); + __ Allocate(r9, r0, r9, r4, &runtime, NO_ALLOCATION_FLAGS); // r0 = address of new object(s) (tagged) // r2 = argument count (smi-tagged) @@ -5073,7 +5065,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ mov(r1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ add(r1, r1, Operand(r0, LSL, kPointerSizeLog2 - 1)); - __ Allocate(r1, r3, r4, r5, &allocate, TAG_OBJECT); + __ Allocate(r1, r3, r4, r5, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in r3. diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc index 7e1a5500f1..4014aba10e 100644 --- a/src/arm/codegen-arm.cc +++ b/src/arm/codegen-arm.cc @@ -450,6 +450,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( __ mov(lr, Operand(length, LSL, 2)); __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); __ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT); + __ sub(array, array, Operand(kHeapObjectTag)); // array: destination FixedDoubleArray, not tagged as heap object. __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); // r4: source FixedArray. @@ -594,11 +595,13 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ add(array_size, array_size, Operand(length, LSL, 1)); __ 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); - __ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); - __ str(scratch, MemOperand(array, HeapObject::kMapOffset)); + __ str(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); + __ str(scratch, FieldMemOperand(array, HeapObject::kMapOffset)); + + __ sub(array, array, Operand(kHeapObjectTag)); // Prepare for conversion loop. Register src_elements = elements; diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 972082439e..f7b5730093 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -2081,10 +2081,8 @@ void MacroAssembler::Allocate(int object_size, b(hi, gc_required); str(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - add(result, result, Operand(kHeapObjectTag)); - } + // Tag object. + add(result, result, Operand(kHeapObjectTag)); } @@ -2177,10 +2175,8 @@ void MacroAssembler::Allocate(Register object_size, Register result, } str(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - add(result, result, Operand(kHeapObjectTag)); - } + // Tag object. + add(result, result, Operand(kHeapObjectTag)); } @@ -2199,12 +2195,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, and_(scratch1, 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, @@ -2228,12 +2220,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, and_(scratch1, 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, @@ -2247,7 +2235,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Register scratch2, Label* gc_required) { Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, @@ -2261,12 +2249,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, scratch1, scratch2); @@ -2279,7 +2263,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, @@ -2295,7 +2279,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); @@ -3211,12 +3195,11 @@ void MacroAssembler::AllocateHeapNumber(Register result, 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 @@ -3224,11 +3207,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, AssertIsRoot(heap_number_map, map_index); // Store heap number map in the allocated object. - if (tagging_mode == TAG_RESULT) { - str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); - } else { - str(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); - } + str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); } @@ -3253,7 +3232,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); diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h index d8af94ccbd..0f9516adf0 100644 --- a/src/arm/macro-assembler-arm.h +++ b/src/arm/macro-assembler-arm.h @@ -816,7 +816,6 @@ class MacroAssembler: public Assembler { Register scratch2, Register heap_number_map, Label* gc_required, - TaggingMode tagging_mode = TAG_RESULT, MutableMode mode = IMMUTABLE); void AllocateHeapNumberWithValue(Register result, DwVfpRegister value, diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc index d9ce8ef716..68bc35d5e0 100644 --- a/src/arm64/code-stubs-arm64.cc +++ b/src/arm64/code-stubs-arm64.cc @@ -4824,17 +4824,18 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ Bind(&done_allocate); // Initialize the JSObject fields. - __ Mov(x1, x0); STATIC_ASSERT(JSObject::kMapOffset == 0 * kPointerSize); - __ Str(x2, MemOperand(x1, kPointerSize, PostIndex)); + __ Str(x2, FieldMemOperand(x0, JSObject::kMapOffset)); __ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex); STATIC_ASSERT(JSObject::kPropertiesOffset == 1 * kPointerSize); STATIC_ASSERT(JSObject::kElementsOffset == 2 * kPointerSize); - __ Stp(x3, x3, MemOperand(x1, 2 * kPointerSize, PostIndex)); + __ Str(x3, FieldMemOperand(x0, JSObject::kPropertiesOffset)); + __ Str(x3, FieldMemOperand(x0, JSObject::kElementsOffset)); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); + __ Add(x1, x0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); // ----------- S t a t e ------------- - // -- x0 : result (untagged) + // -- x0 : result (tagged) // -- x1 : result fields (untagged) // -- x5 : result end (untagged) // -- x2 : initial map @@ -4852,10 +4853,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { { // Initialize all in-object fields with undefined. __ InitializeFieldsWithFiller(x1, x5, x6); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ Add(x0, x0, kHeapObjectTag); __ Ret(); } __ Bind(&slack_tracking); @@ -4874,10 +4871,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ LoadRoot(x6, Heap::kOnePointerFillerMapRootIndex); __ InitializeFieldsWithFiller(x1, x5, x6); - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ Add(x0, x0, kHeapObjectTag); - // Check if we can finalize the instance size. Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); @@ -4907,10 +4900,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(x2); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ Sub(x0, x0, kHeapObjectTag); __ Ldrb(x5, FieldMemOperand(x2, Map::kInstanceSizeOffset)); __ Add(x5, x0, Operand(x5, LSL, kPointerSizeLog2)); + STATIC_ASSERT(kHeapObjectTag == 1); + __ Sub(x5, x5, kHeapObjectTag); // Subtract the tag from end. __ B(&done_allocate); // Fall back to %NewObject. @@ -4974,7 +4967,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, x0, x1, x2, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, x0, x1, x2, &allocate, NO_ALLOCATION_FLAGS); __ Bind(&done_allocate); // Setup the rest parameter array in x0. @@ -5015,7 +5008,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ Mov(x1, JSArray::kSize + FixedArray::kHeaderSize); __ Add(x1, x1, Operand(x0, LSL, kPointerSizeLog2)); - __ Allocate(x1, x3, x4, x5, &allocate, TAG_OBJECT); + __ Allocate(x1, x3, x4, x5, &allocate, NO_ALLOCATION_FLAGS); __ Bind(&done_allocate); // Compute arguments.length in x6. @@ -5192,7 +5185,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { // Do the allocation of all three objects in one go. Assign this to x0, as it // will be returned to the caller. Register alloc_obj = x0; - __ Allocate(size, alloc_obj, x11, x12, &runtime, TAG_OBJECT); + __ Allocate(size, alloc_obj, x11, x12, &runtime, NO_ALLOCATION_FLAGS); // Get the arguments boilerplate from the current (global) context. @@ -5426,7 +5419,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ Mov(x1, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize); __ Add(x1, x1, Operand(x0, LSL, kPointerSizeLog2)); - __ Allocate(x1, x3, x4, x5, &allocate, TAG_OBJECT); + __ Allocate(x1, x3, x4, x5, &allocate, NO_ALLOCATION_FLAGS); __ Bind(&done_allocate); // Compute arguments.length in x6. diff --git a/src/arm64/codegen-arm64.cc b/src/arm64/codegen-arm64.cc index c2073f1f4b..990dd4101f 100644 --- a/src/arm64/codegen-arm64.cc +++ b/src/arm64/codegen-arm64.cc @@ -175,8 +175,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( Register map_root = array_size; __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); __ SmiTag(x11, length); - __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); - __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); + __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); + __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset)); __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch, @@ -184,18 +184,18 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( OMIT_SMI_CHECK); // Replace receiver's backing store with newly created FixedDoubleArray. - __ Add(x10, array, kHeapObjectTag); - __ Str(x10, FieldMemOperand(receiver, JSObject::kElementsOffset)); - __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, - scratch, kLRHasBeenSaved, kDontSaveFPRegs, - EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); + __ Move(x10, array); + __ Str(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); + __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, scratch, + kLRHasBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, + OMIT_SMI_CHECK); // Prepare for conversion loop. Register src_elements = x10; Register dst_elements = x11; Register dst_end = x12; __ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); - __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize); + __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize - kHeapObjectTag); __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2)); FPRegister nan_d = d1; @@ -282,8 +282,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( Register map_root = array_size; __ LoadRoot(map_root, Heap::kFixedArrayMapRootIndex); __ SmiTag(x11, length); - __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); - __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); + __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); + __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset)); // Prepare for conversion loop. Register src_elements = x10; @@ -293,7 +293,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); __ Add(src_elements, elements, FixedDoubleArray::kHeaderSize - kHeapObjectTag); - __ Add(dst_elements, array, FixedArray::kHeaderSize); + __ Add(dst_elements, array, FixedArray::kHeaderSize - kHeapObjectTag); __ Add(dst_end, dst_elements, Operand(length, LSL, kPointerSizeLog2)); // Allocating heap numbers in the loop below can fail and cause a jump to @@ -307,8 +307,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ Cmp(dst_elements, dst_end); __ B(lt, &initialization_loop); - __ Add(dst_elements, array, FixedArray::kHeaderSize); - __ Add(array, array, kHeapObjectTag); + __ Add(dst_elements, array, FixedArray::kHeaderSize - kHeapObjectTag); Register heap_num_map = x15; __ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex); diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc index a66d5ad264..0e4f2ea6b1 100644 --- a/src/arm64/macro-assembler-arm64.cc +++ b/src/arm64/macro-assembler-arm64.cc @@ -3094,10 +3094,8 @@ void MacroAssembler::Allocate(int object_size, B(hi, gc_required); Str(result_end, MemOperand(top_address)); - // Tag the object if requested. - if ((flags & TAG_OBJECT) != 0) { - ObjectTag(result, result); - } + // Tag the object. + ObjectTag(result, result); } @@ -3174,10 +3172,8 @@ void MacroAssembler::Allocate(Register object_size, Register result, B(hi, gc_required); Str(result_end, MemOperand(top_address)); - // Tag the object if requested. - if ((flags & TAG_OBJECT) != 0) { - ObjectTag(result, result); - } + // Tag the object. + ObjectTag(result, result); } @@ -3196,12 +3192,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, Bic(scratch1, scratch1, 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, @@ -3225,12 +3217,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, Bic(scratch1, scratch1, 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, @@ -3244,7 +3232,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Register scratch2, Label* gc_required) { Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, @@ -3258,12 +3246,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, scratch1, scratch2); @@ -3277,7 +3261,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result, Label* gc_required) { DCHECK(!AreAliased(result, length, scratch1, scratch2)); Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, @@ -3294,7 +3278,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result, Label* gc_required) { DCHECK(!AreAliased(result, length, scratch1, scratch2)); Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, scratch1, scratch2); @@ -3348,14 +3332,14 @@ void MacroAssembler::AllocateHeapNumber(Register result, if (value.IsSameSizeAndType(heap_number_map)) { STATIC_ASSERT(HeapObject::kMapOffset + kPointerSize == HeapNumber::kValueOffset); - Stp(heap_number_map, value, MemOperand(result, HeapObject::kMapOffset)); + Stp(heap_number_map, value, + FieldMemOperand(result, HeapObject::kMapOffset)); } else { - Str(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); + Str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); if (value.IsValid()) { - Str(value, MemOperand(result, HeapNumber::kValueOffset)); + Str(value, FieldMemOperand(result, HeapNumber::kValueOffset)); } } - ObjectTag(result, result); } @@ -3379,7 +3363,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); diff --git a/src/crankshaft/arm/lithium-codegen-arm.cc b/src/crankshaft/arm/lithium-codegen-arm.cc index 26b852039b..a282d9ba16 100644 --- a/src/crankshaft/arm/lithium-codegen-arm.cc +++ b/src/crankshaft/arm/lithium-codegen-arm.cc @@ -4496,7 +4496,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, if (FLAG_inline_new) { __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); - __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, DONT_TAG_RESULT); + __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); __ b(&done); } @@ -4520,15 +4520,13 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); - __ sub(r0, r0, Operand(kHeapObjectTag)); __ StoreToSafepointRegisterSlot(r0, dst); } // Done. Put the value in dbl_scratch into the value of the allocated heap // number. __ bind(&done); - __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); - __ add(dst, dst, Operand(kHeapObjectTag)); + __ vstr(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset)); } @@ -4553,16 +4551,12 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) { DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); if (FLAG_inline_new) { __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); - // We want the untagged address first for performance - __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), - DONT_TAG_RESULT); + __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); } else { __ jmp(deferred->entry()); } __ bind(deferred->exit()); - __ vstr(input_reg, reg, HeapNumber::kValueOffset); - // Now that we have finished with the object's real address tag it - __ add(reg, reg, Operand(kHeapObjectTag)); + __ vstr(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset)); } @@ -4583,7 +4577,6 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); - __ sub(r0, r0, Operand(kHeapObjectTag)); __ StoreToSafepointRegisterSlot(r0, reg); } @@ -5107,7 +5100,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(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/arm64/lithium-codegen-arm64.cc b/src/crankshaft/arm64/lithium-codegen-arm64.cc index 037a47c57e..c655b38255 100644 --- a/src/crankshaft/arm64/lithium-codegen-arm64.cc +++ b/src/crankshaft/arm64/lithium-codegen-arm64.cc @@ -1416,7 +1416,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) { Register temp2 = ToRegister(instr->temp2()); // Allocate memory for the object. - AllocationFlags flags = TAG_OBJECT; + AllocationFlags flags = NO_ALLOCATION_FLAGS; if (instr->hydrogen()->MustAllocateDoubleAligned()) { flags = static_cast(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc index f2fffa1c50..16b3f5d01f 100644 --- a/src/crankshaft/ia32/lithium-codegen-ia32.cc +++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc @@ -4861,7 +4861,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) { Register temp = ToRegister(instr->temp()); // Allocate memory for the object. - AllocationFlags flags = TAG_OBJECT; + AllocationFlags flags = NO_ALLOCATION_FLAGS; if (instr->hydrogen()->MustAllocateDoubleAligned()) { flags = static_cast(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/mips/lithium-codegen-mips.cc b/src/crankshaft/mips/lithium-codegen-mips.cc index 33c9afa9e2..667fcbe92c 100644 --- a/src/crankshaft/mips/lithium-codegen-mips.cc +++ b/src/crankshaft/mips/lithium-codegen-mips.cc @@ -4439,7 +4439,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, if (FLAG_inline_new) { __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); - __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, DONT_TAG_RESULT); + __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); __ Branch(&done); } @@ -4463,16 +4463,13 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); - __ Subu(v0, v0, kHeapObjectTag); __ StoreToSafepointRegisterSlot(v0, dst); } - // Done. Put the value in dbl_scratch into the value of the allocated heap // number. __ bind(&done); - __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); - __ Addu(dst, dst, kHeapObjectTag); + __ sdc1(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset)); } @@ -4497,16 +4494,13 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) { DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); if (FLAG_inline_new) { __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); - // We want the untagged address first for performance - __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), - DONT_TAG_RESULT); + __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); } else { __ Branch(deferred->entry()); } __ bind(deferred->exit()); - __ sdc1(input_reg, MemOperand(reg, HeapNumber::kValueOffset)); + __ sdc1(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset)); // Now that we have finished with the object's real address tag it - __ Addu(reg, reg, kHeapObjectTag); } @@ -4527,7 +4521,6 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); - __ Subu(v0, v0, kHeapObjectTag); __ StoreToSafepointRegisterSlot(v0, reg); } @@ -5075,7 +5068,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(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/mips64/lithium-codegen-mips64.cc b/src/crankshaft/mips64/lithium-codegen-mips64.cc index 972d50dfd0..1757a24f4f 100644 --- a/src/crankshaft/mips64/lithium-codegen-mips64.cc +++ b/src/crankshaft/mips64/lithium-codegen-mips64.cc @@ -4645,7 +4645,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr, if (FLAG_inline_new) { __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); - __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, TAG_RESULT); + __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow); __ Branch(&done); } @@ -4700,15 +4700,12 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) { if (FLAG_inline_new) { __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); // We want the untagged address first for performance - __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), - DONT_TAG_RESULT); + __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); } else { __ Branch(deferred->entry()); } __ bind(deferred->exit()); - __ sdc1(input_reg, MemOperand(reg, HeapNumber::kValueOffset)); - // Now that we have finished with the object's real address tag it - __ Daddu(reg, reg, kHeapObjectTag); + __ sdc1(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset)); } @@ -4729,7 +4726,6 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); - __ Dsubu(v0, v0, kHeapObjectTag); __ StoreToSafepointRegisterSlot(v0, reg); } @@ -5276,7 +5272,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(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc index 5ff0031554..31fef4a54d 100644 --- a/src/crankshaft/x64/lithium-codegen-x64.cc +++ b/src/crankshaft/x64/lithium-codegen-x64.cc @@ -5161,7 +5161,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) { Register temp = ToRegister(instr->temp()); // Allocate memory for the object. - AllocationFlags flags = TAG_OBJECT; + AllocationFlags flags = NO_ALLOCATION_FLAGS; if (instr->hydrogen()->MustAllocateDoubleAligned()) { flags = static_cast(flags | DOUBLE_ALIGNMENT); } diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc index 14c5617c84..79f8bb5c00 100644 --- a/src/crankshaft/x87/lithium-codegen-x87.cc +++ b/src/crankshaft/x87/lithium-codegen-x87.cc @@ -5403,7 +5403,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) { Register temp = ToRegister(instr->temp()); // Allocate memory for the object. - AllocationFlags flags = TAG_OBJECT; + AllocationFlags flags = NO_ALLOCATION_FLAGS; if (instr->hydrogen()->MustAllocateDoubleAligned()) { flags = static_cast(flags | DOUBLE_ALIGNMENT); } diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc index 49a35c8518..68a21a436e 100644 --- a/src/full-codegen/arm/full-codegen-arm.cc +++ b/src/full-codegen/arm/full-codegen-arm.cc @@ -1898,7 +1898,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &allocate, + NO_ALLOCATION_FLAGS); __ b(&done_allocate); __ bind(&allocate); @@ -3194,7 +3195,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, r0, r2, r3, &runtime, + NO_ALLOCATION_FLAGS); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r1); __ pop(r3); __ pop(r2); diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc index 7d918816ed..19db20523f 100644 --- a/src/full-codegen/arm64/full-codegen-arm64.cc +++ b/src/full-codegen/arm64/full-codegen-arm64.cc @@ -3100,7 +3100,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; Register result = x0; - __ Allocate(JSIteratorResult::kSize, result, x10, x11, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, result, x10, x11, &runtime, + NO_ALLOCATION_FLAGS); Register map_reg = x1; Register result_value = x2; Register boolean_done = x3; @@ -3799,7 +3800,8 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { // Allocate and populate an object with this form: { value: VAL, done: DONE } Register result = x0; - __ Allocate(JSIteratorResult::kSize, result, x10, x11, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, result, x10, x11, &allocate, + NO_ALLOCATION_FLAGS); __ B(&done_allocate); __ Bind(&allocate); diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc index 6f8069c096..3c49268dac 100644 --- a/src/full-codegen/ia32/full-codegen-ia32.cc +++ b/src/full-codegen/ia32/full-codegen-ia32.cc @@ -1811,7 +1811,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, + NO_ALLOCATION_FLAGS); __ jmp(&done_allocate, Label::kNear); __ bind(&allocate); @@ -3095,7 +3096,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, + NO_ALLOCATION_FLAGS); __ mov(ebx, NativeContextOperand()); __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc index 4289b7dbd3..50cf79ee29 100644 --- a/src/full-codegen/mips/full-codegen-mips.cc +++ b/src/full-codegen/mips/full-codegen-mips.cc @@ -1902,7 +1902,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, + NO_ALLOCATION_FLAGS); __ jmp(&done_allocate); __ bind(&allocate); @@ -3214,7 +3215,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, + NO_ALLOCATION_FLAGS); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1); __ Pop(a2, a3); __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc index 922eac655c..2937127ec5 100644 --- a/src/full-codegen/mips64/full-codegen-mips64.cc +++ b/src/full-codegen/mips64/full-codegen-mips64.cc @@ -1903,7 +1903,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, + NO_ALLOCATION_FLAGS); __ jmp(&done_allocate); __ bind(&allocate); @@ -3214,7 +3215,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, + NO_ALLOCATION_FLAGS); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1); __ Pop(a2, a3); __ LoadRoot(a4, Heap::kEmptyFixedArrayRootIndex); diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc index aee3c8c018..0eca0a1faf 100644 --- a/src/full-codegen/x64/full-codegen-x64.cc +++ b/src/full-codegen/x64/full-codegen-x64.cc @@ -1836,7 +1836,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &allocate, + NO_ALLOCATION_FLAGS); __ jmp(&done_allocate, Label::kNear); __ bind(&allocate); @@ -3083,7 +3084,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &runtime, + NO_ALLOCATION_FLAGS); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, rbx); __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 384ea45508..5f5314d4c4 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -1803,7 +1803,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() { void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label allocate, done_allocate; - __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, + NO_ALLOCATION_FLAGS); __ jmp(&done_allocate, Label::kNear); __ bind(&allocate); @@ -3087,7 +3088,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { Label runtime, done; - __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT); + __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, + NO_ALLOCATION_FLAGS); __ mov(ebx, NativeContextOperand()); __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 7ba3d955fd..76e09e5ef5 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -4714,16 +4714,16 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ mov(Operand(eax, JSObject::kMapOffset), ecx); - __ mov(Operand(eax, JSObject::kPropertiesOffset), + __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); + __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), masm->isolate()->factory()->empty_fixed_array()); - __ mov(Operand(eax, JSObject::kElementsOffset), + __ mov(FieldOperand(eax, JSObject::kElementsOffset), masm->isolate()->factory()->empty_fixed_array()); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ lea(ebx, Operand(eax, JSObject::kHeaderSize)); + __ lea(ebx, FieldOperand(eax, JSObject::kHeaderSize)); // ----------- S t a t e ------------- - // -- eax : result (untagged) + // -- eax : result (tagged) // -- ebx : result fields (untagged) // -- edi : result end (untagged) // -- ecx : initial map @@ -4741,10 +4741,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { // Initialize all in-object fields with undefined. __ LoadRoot(edx, Heap::kUndefinedValueRootIndex); __ InitializeFieldsWithFiller(ebx, edi, edx); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ inc(eax); __ Ret(); } __ bind(&slack_tracking); @@ -4767,10 +4763,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex); __ InitializeFieldsWithFiller(ebx, edx, edi); - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ inc(eax); - // Check if we can finalize the instance size. Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); @@ -4801,10 +4793,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(ecx); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ dec(eax); __ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset)); __ lea(edi, Operand(eax, ebx, times_pointer_size, 0)); + STATIC_ASSERT(kHeapObjectTag == 1); + __ dec(edi); __ jmp(&done_allocate); // Fall back to %NewObject. @@ -4868,7 +4860,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, eax, edx, ecx, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, eax, edx, ecx, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in rax. @@ -4910,7 +4902,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ lea(ecx, Operand(eax, times_half_pointer_size, JSArray::kSize + FixedArray::kHeaderSize)); - __ Allocate(ecx, edx, edi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(ecx, edx, edi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in edx. @@ -5050,7 +5042,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ add(ebx, Immediate(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); + __ Allocate(ebx, eax, edi, no_reg, &runtime, NO_ALLOCATION_FLAGS); // eax = address of new object(s) (tagged) // ecx = argument count (smi-tagged) @@ -5280,7 +5272,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { __ lea(ecx, Operand(eax, times_half_pointer_size, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); - __ Allocate(ecx, edx, edi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(ecx, edx, edi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in edx. diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc index 2190531b43..36c83cce23 100644 --- a/src/ia32/codegen-ia32.cc +++ b/src/ia32/codegen-ia32.cc @@ -586,8 +586,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( // Allocate new FixedDoubleArray. // edx: receiver // edi: length of source FixedArray (smi-tagged) - AllocationFlags flags = - static_cast(TAG_OBJECT | DOUBLE_ALIGNMENT); + AllocationFlags flags = static_cast(DOUBLE_ALIGNMENT); __ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags); @@ -714,7 +713,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( // Allocate new FixedArray. // ebx: length of source FixedDoubleArray (smi-tagged) __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); - __ Allocate(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); + __ Allocate(edi, eax, esi, no_reg, &gc_required, NO_ALLOCATION_FLAGS); // eax: destination FixedArray // ebx: number of elements diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 42d4415c5b..fb15302308 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1578,15 +1578,10 @@ void MacroAssembler::Allocate(int object_size, // Update allocation top. UpdateAllocationTopHelper(top_reg, scratch, flags); - // Tag result if requested. - bool tag_result = (flags & TAG_OBJECT) != 0; if (top_reg.is(result)) { - if (tag_result) { - sub(result, Immediate(object_size - kHeapObjectTag)); - } else { - sub(result, Immediate(object_size)); - } - } else if (tag_result) { + sub(result, Immediate(object_size - kHeapObjectTag)); + } else { + // Tag the result. DCHECK(kHeapObjectTag == 1); inc(result); } @@ -1660,10 +1655,9 @@ void MacroAssembler::Allocate(int header_size, cmp(result_end, Operand::StaticVariable(allocation_limit)); j(above, gc_required); - if ((flags & TAG_OBJECT) != 0) { - DCHECK(kHeapObjectTag == 1); - inc(result); - } + // Tag result. + DCHECK(kHeapObjectTag == 1); + inc(result); // Update allocation top. UpdateAllocationTopHelper(result_end, scratch, flags); @@ -1724,11 +1718,9 @@ void MacroAssembler::Allocate(Register object_size, cmp(result_end, Operand::StaticVariable(allocation_limit)); j(above, gc_required); - // Tag result if requested. - if ((flags & TAG_OBJECT) != 0) { - DCHECK(kHeapObjectTag == 1); - inc(result); - } + // Tag result. + DCHECK(kHeapObjectTag == 1); + inc(result); // Update allocation top. UpdateAllocationTopHelper(result_end, scratch, flags); @@ -1742,7 +1734,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, MutableMode mode) { // Allocate heap number in new space. Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); Handle map = mode == MUTABLE ? isolate()->factory()->mutable_heap_number_map() @@ -1768,15 +1760,9 @@ void MacroAssembler::AllocateTwoByteString(Register result, and_(scratch1, Immediate(~kObjectAlignmentMask)); // Allocate two byte string in new space. - Allocate(SeqTwoByteString::kHeaderSize, - times_1, - scratch1, - REGISTER_VALUE_IS_INT32, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1, + REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required, + NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1802,15 +1788,9 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, and_(scratch1, Immediate(~kObjectAlignmentMask)); // Allocate one-byte string in new space. - Allocate(SeqOneByteString::kHeaderSize, - times_1, - scratch1, - REGISTER_VALUE_IS_INT32, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1, + REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required, + NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1830,7 +1810,7 @@ void MacroAssembler::AllocateOneByteString(Register result, int length, // Allocate one-byte string in new space. Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2, - gc_required, TAG_OBJECT); + gc_required, NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1848,7 +1828,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1860,12 +1840,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1879,7 +1855,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1893,7 +1869,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1909,7 +1885,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor, DCHECK(!result.is(value)); // Allocate JSValue in new space. - Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); + Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, + NO_ALLOCATION_FLAGS); // Initialize the JSValue. LoadGlobalFunctionInitialMap(constructor, scratch); diff --git a/src/macro-assembler.h b/src/macro-assembler.h index 6338b2c1c1..2e4d1914a3 100644 --- a/src/macro-assembler.h +++ b/src/macro-assembler.h @@ -19,21 +19,18 @@ enum InvokeFlag { enum AllocationFlags { // No special flags. NO_ALLOCATION_FLAGS = 0, - // Return the pointer to the allocated already tagged as a heap object. - TAG_OBJECT = 1 << 0, // The content of the result register already contains the allocation top in // new space. - RESULT_CONTAINS_TOP = 1 << 1, + RESULT_CONTAINS_TOP = 1 << 0, // Specify that the requested size of the space to allocate is specified in // words instead of bytes. - SIZE_IN_WORDS = 1 << 2, + SIZE_IN_WORDS = 1 << 1, // Align the allocation to a multiple of kDoubleSize - DOUBLE_ALIGNMENT = 1 << 3, + DOUBLE_ALIGNMENT = 1 << 2, // Directly allocate in old space - PRETENURE = 1 << 4, + PRETENURE = 1 << 3, }; - #if V8_TARGET_ARCH_IA32 #include "src/ia32/assembler-ia32.h" #include "src/ia32/assembler-ia32-inl.h" diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index f913088a45..85d244955c 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -4748,15 +4748,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ sw(a2, MemOperand(v0, JSObject::kMapOffset)); + __ sw(a2, FieldMemOperand(v0, JSObject::kMapOffset)); __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); - __ sw(a3, MemOperand(v0, JSObject::kPropertiesOffset)); - __ sw(a3, MemOperand(v0, JSObject::kElementsOffset)); + __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); + __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ Addu(a1, v0, Operand(JSObject::kHeaderSize)); + __ Addu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); // ----------- S t a t e ------------- - // -- v0 : result (untagged) + // -- v0 : result (tagged) // -- a1 : result fields (untagged) // -- t1 : result end (untagged) // -- a2 : initial map @@ -4774,11 +4774,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { { // Initialize all in-object fields with undefined. __ InitializeFieldsWithFiller(a1, t1, a0); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ Ret(USE_DELAY_SLOT); - __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. + __ Ret(); } __ bind(&slack_tracking); { @@ -4801,9 +4797,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); - __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); - STATIC_ASSERT(kHeapObjectTag == 1); - __ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. + __ Branch(&finalize, eq, a3, Operand(zero_reg)); __ Ret(); // Finalize the instance size. @@ -4828,10 +4822,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(a2); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ Subu(v0, v0, Operand(kHeapObjectTag)); __ lbu(t1, FieldMemOperand(a2, Map::kInstanceSizeOffset)); __ Lsa(t1, v0, t1, kPointerSizeLog2); + STATIC_ASSERT(kHeapObjectTag == 1); + __ Subu(t1, t1, Operand(kHeapObjectTag)); __ jmp(&done_allocate); // Fall back to %NewObject. @@ -4893,7 +4887,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in v0. @@ -4935,7 +4929,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); - __ Allocate(a1, v0, a3, t0, &allocate, TAG_OBJECT); + __ Allocate(a1, v0, a3, t0, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in v0. @@ -5069,7 +5063,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(t5, v0, t5, t0, &runtime, TAG_OBJECT); + __ Allocate(t5, v0, t5, t0, &runtime, NO_ALLOCATION_FLAGS); // v0 = address of new object(s) (tagged) // a2 = argument count (smi-tagged) @@ -5271,7 +5265,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); - __ Allocate(a1, v0, a3, t0, &allocate, TAG_OBJECT); + __ Allocate(a1, v0, a3, t0, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in v0. diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc index 1c6c1692ae..63bbda3168 100644 --- a/src/mips/codegen-mips.cc +++ b/src/mips/codegen-mips.cc @@ -733,13 +733,13 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( __ sll(scratch, length, 2); __ Addu(scratch, scratch, FixedDoubleArray::kHeaderSize); __ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT); - // array: destination FixedDoubleArray, not tagged as heap object + // array: destination FixedDoubleArray, tagged as heap object // Set destination FixedDoubleArray's length and map. __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); - __ sw(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); + __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); // Update receiver's map. - __ sw(scratch2, MemOperand(array, HeapObject::kMapOffset)); + __ sw(scratch2, FieldMemOperand(array, HeapObject::kMapOffset)); __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); __ RecordWriteField(receiver, @@ -751,7 +751,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( OMIT_REMEMBERED_SET, OMIT_SMI_CHECK); // Replace receiver's backing store with newly created FixedDoubleArray. - __ Addu(scratch1, array, Operand(kHeapObjectTag)); + __ Addu(scratch1, array, Operand(kHeapObjectTag - kHeapObjectTag)); __ sw(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset)); __ RecordWriteField(receiver, JSObject::kElementsOffset, @@ -766,7 +766,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( // Prepare for conversion loop. __ Addu(scratch1, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); - __ Addu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); + __ Addu(scratch3, array, + Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); __ Lsa(array_end, scratch3, length, 2); // Repurpose registers no longer in use. @@ -886,8 +887,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( // array: destination FixedArray, not tagged as heap object // Set destination FixedDoubleArray's length and map. __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); - __ sw(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); - __ sw(scratch, MemOperand(array, HeapObject::kMapOffset)); + __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset)); + __ sw(scratch, FieldMemOperand(array, HeapObject::kMapOffset)); // Prepare for conversion loop. Register src_elements = elements; @@ -897,7 +898,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ Addu(src_elements, src_elements, Operand( FixedDoubleArray::kHeaderSize - kHeapObjectTag + Register::kExponentOffset)); - __ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); + __ Addu(dst_elements, array, + Operand(FixedArray::kHeaderSize - kHeapObjectTag)); __ Lsa(dst_end, dst_elements, dst_end, 1); // Allocating heap numbers in the loop below can fail and cause a jump to @@ -912,8 +914,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ bind(&initialization_loop_entry); __ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end)); - __ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); - __ Addu(array, array, Operand(kHeapObjectTag)); + __ Addu(dst_elements, array, + Operand(FixedArray::kHeaderSize - kHeapObjectTag)); __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); // Using offsetted addresses. // dst_elements: begin of destination FixedArray element fields, not tagged diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 9312eed02f..c2d5bb6a44 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -3974,10 +3974,8 @@ void MacroAssembler::Allocate(int object_size, Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); sw(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - Addu(result, result, Operand(kHeapObjectTag)); - } + // Tag object. + Addu(result, result, Operand(kHeapObjectTag)); } @@ -4065,10 +4063,8 @@ void MacroAssembler::Allocate(Register object_size, Register result, } sw(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - Addu(result, result, Operand(kHeapObjectTag)); - } + // Tag object. + Addu(result, result, Operand(kHeapObjectTag)); } @@ -4087,12 +4083,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, And(scratch1, 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, @@ -4115,12 +4107,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, And(scratch1, 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, @@ -4134,7 +4122,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Register scratch2, Label* gc_required) { Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsStringMapRootIndex, @@ -4147,12 +4135,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, scratch1, scratch2); @@ -4165,7 +4149,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, @@ -4181,7 +4165,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); @@ -4207,12 +4191,11 @@ void MacroAssembler::AllocateHeapNumber(Register result, Register scratch2, Register heap_number_map, Label* need_gc, - 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, need_gc, - tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS); + NO_ALLOCATION_FLAGS); Heap::RootListIndex map_index = mode == MUTABLE ? Heap::kMutableHeapNumberMapRootIndex @@ -4220,11 +4203,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, AssertIsRoot(heap_number_map, map_index); // Store heap number map in the allocated object. - if (tagging_mode == TAG_RESULT) { - sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); - } else { - sw(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); - } + sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); } @@ -4248,7 +4227,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); diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index 947110d656..5e974960fc 100644 --- a/src/mips/macro-assembler-mips.h +++ b/src/mips/macro-assembler-mips.h @@ -588,7 +588,6 @@ class MacroAssembler: public Assembler { Register scratch2, Register heap_number_map, Label* gc_required, - TaggingMode tagging_mode = TAG_RESULT, MutableMode mode = IMMUTABLE); void AllocateHeapNumberWithValue(Register result, FPURegister value, diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc index c68608044c..a3cf1a1f4e 100644 --- a/src/mips64/code-stubs-mips64.cc +++ b/src/mips64/code-stubs-mips64.cc @@ -4758,15 +4758,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ sd(a2, MemOperand(v0, JSObject::kMapOffset)); + __ sd(a2, FieldMemOperand(v0, JSObject::kMapOffset)); __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); - __ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset)); - __ sd(a3, MemOperand(v0, JSObject::kElementsOffset)); + __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); + __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ Daddu(a1, v0, Operand(JSObject::kHeaderSize)); + __ Daddu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag)); // ----------- S t a t e ------------- - // -- v0 : result (untagged) + // -- v0 : result (tagged) // -- a1 : result fields (untagged) // -- a5 : result end (untagged) // -- a2 : initial map @@ -4784,11 +4784,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { { // Initialize all in-object fields with undefined. __ InitializeFieldsWithFiller(a1, a5, a0); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ Ret(USE_DELAY_SLOT); - __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. + __ Ret(); } __ bind(&slack_tracking); { @@ -4811,9 +4807,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); __ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); - __ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); - STATIC_ASSERT(kHeapObjectTag == 1); - __ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot. + __ Branch(&finalize, eq, a3, Operand(zero_reg)); __ Ret(); // Finalize the instance size. @@ -4839,10 +4833,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(a2); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ Dsubu(v0, v0, Operand(kHeapObjectTag)); __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); __ Dlsa(a5, v0, a5, kPointerSizeLog2); + STATIC_ASSERT(kHeapObjectTag == 1); + __ Dsubu(a5, a5, Operand(kHeapObjectTag)); __ jmp(&done_allocate); // Fall back to %NewObject. @@ -4905,7 +4899,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, v0, a0, a1, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in v0. @@ -4947,7 +4941,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ Dlsa(a1, a1, a0, kPointerSizeLog2); - __ Allocate(a1, v0, a3, a4, &allocate, TAG_OBJECT); + __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Compute arguments.length in a4. @@ -5088,7 +5082,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(t1, v0, t1, a4, &runtime, TAG_OBJECT); + __ Allocate(t1, v0, t1, a4, &runtime, NO_ALLOCATION_FLAGS); // v0 = address of new object(s) (tagged) // a2 = argument count (smi-tagged) @@ -5294,7 +5288,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ Dlsa(a1, a1, a0, kPointerSizeLog2); - __ Allocate(a1, v0, a3, a4, &allocate, TAG_OBJECT); + __ Allocate(a1, v0, a3, a4, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Compute arguments.length in a4. diff --git a/src/mips64/codegen-mips64.cc b/src/mips64/codegen-mips64.cc index 44d822b615..678f606cb5 100644 --- a/src/mips64/codegen-mips64.cc +++ b/src/mips64/codegen-mips64.cc @@ -732,6 +732,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( __ SmiScale(scratch, length, kDoubleSizeLog2); __ Daddu(scratch, scratch, FixedDoubleArray::kHeaderSize); __ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT); + __ Dsubu(array, array, kHeapObjectTag); // array: destination FixedDoubleArray, not tagged as heap object // Set destination FixedDoubleArray's length and map. @@ -882,6 +883,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( __ Daddu(array_size, array_size, FixedDoubleArray::kHeaderSize); __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, NO_ALLOCATION_FLAGS); + __ Dsubu(array, array, kHeapObjectTag); // array: destination FixedArray, not tagged as heap object // Set destination FixedDoubleArray's length and map. __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc index ef3ba9876e..552225a894 100644 --- a/src/mips64/macro-assembler-mips64.cc +++ b/src/mips64/macro-assembler-mips64.cc @@ -4144,10 +4144,8 @@ void MacroAssembler::Allocate(int object_size, Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); sd(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - Daddu(result, result, Operand(kHeapObjectTag)); - } + // Tag object. + Daddu(result, result, Operand(kHeapObjectTag)); } @@ -4226,10 +4224,8 @@ void MacroAssembler::Allocate(Register object_size, Register result, } sd(result_end, MemOperand(top_address)); - // Tag object if requested. - if ((flags & TAG_OBJECT) != 0) { - Daddu(result, result, Operand(kHeapObjectTag)); - } + // Tag object if. + Daddu(result, result, Operand(kHeapObjectTag)); } @@ -4248,12 +4244,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, And(scratch1, 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, @@ -4277,12 +4269,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, And(scratch1, 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, @@ -4296,7 +4284,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Register scratch2, Label* gc_required) { Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsStringMapRootIndex, @@ -4309,12 +4297,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, scratch1, scratch2); @@ -4327,7 +4311,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, @@ -4343,7 +4327,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); @@ -4369,12 +4353,11 @@ void MacroAssembler::AllocateHeapNumber(Register result, Register scratch2, Register heap_number_map, Label* need_gc, - 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, need_gc, - tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS); + NO_ALLOCATION_FLAGS); Heap::RootListIndex map_index = mode == MUTABLE ? Heap::kMutableHeapNumberMapRootIndex @@ -4382,11 +4365,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, AssertIsRoot(heap_number_map, map_index); // Store heap number map in the allocated object. - if (tagging_mode == TAG_RESULT) { - sd(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); - } else { - sd(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); - } + sd(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); } @@ -4410,7 +4389,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); diff --git a/src/mips64/macro-assembler-mips64.h b/src/mips64/macro-assembler-mips64.h index fbb593c754..7de50b1ef5 100644 --- a/src/mips64/macro-assembler-mips64.h +++ b/src/mips64/macro-assembler-mips64.h @@ -620,7 +620,6 @@ class MacroAssembler: public Assembler { Register scratch2, Register heap_number_map, Label* gc_required, - TaggingMode tagging_mode = TAG_RESULT, MutableMode mode = IMMUTABLE); void AllocateHeapNumberWithValue(Register result, diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index ee61b37f4d..fc88336ee4 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -4449,15 +4449,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ movp(Operand(rax, JSObject::kMapOffset), rcx); + __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx); __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); - __ movp(Operand(rax, JSObject::kPropertiesOffset), rbx); - __ movp(Operand(rax, JSObject::kElementsOffset), rbx); + __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); + __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ leap(rbx, Operand(rax, JSObject::kHeaderSize)); + __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize)); // ----------- S t a t e ------------- - // -- rax : result (untagged) + // -- rax : result (tagged) // -- rbx : result fields (untagged) // -- rdi : result end (untagged) // -- rcx : initial map @@ -4475,10 +4475,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { { // Initialize all in-object fields with undefined. __ InitializeFieldsWithFiller(rbx, rdi, r11); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ incp(rax); __ Ret(); } __ bind(&slack_tracking); @@ -4498,10 +4494,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ LoadRoot(r11, Heap::kOnePointerFillerMapRootIndex); __ InitializeFieldsWithFiller(rdx, rdi, r11); - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ incp(rax); - // Check if we can finalize the instance size. Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); @@ -4532,10 +4524,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(rcx); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ decp(rax); __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); __ leap(rdi, Operand(rax, rbx, times_pointer_size, 0)); + STATIC_ASSERT(kHeapObjectTag == 1); + __ decp(rdi); // Remove the tag from the end address. __ jmp(&done_allocate); // Fall back to %NewObject. @@ -4601,7 +4593,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, rax, rdx, rcx, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in rax. @@ -4642,7 +4634,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ leal(rcx, Operand(rax, times_pointer_size, JSArray::kSize + FixedArray::kHeaderSize)); - __ Allocate(rcx, rdx, rdi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(rcx, rdx, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Compute the arguments.length in rdi. @@ -4790,7 +4782,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ addp(r8, Immediate(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(r8, rax, r9, no_reg, &runtime, TAG_OBJECT); + __ Allocate(r8, rax, r9, no_reg, &runtime, NO_ALLOCATION_FLAGS); // rax = address of new object(s) (tagged) // r11 = argument count (untagged) @@ -4994,7 +4986,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ leal(rcx, Operand(rax, times_pointer_size, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); - __ Allocate(rcx, rdx, rdi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(rcx, rdx, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Compute the arguments.length in rdi. diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc index 33e987e248..114cbdc2d0 100644 --- a/src/x64/codegen-x64.cc +++ b/src/x64/codegen-x64.cc @@ -204,7 +204,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( // Allocate new backing store. __ bind(&new_backing_store); __ leap(rdi, Operand(r9, times_8, FixedArray::kHeaderSize)); - __ Allocate(rdi, r14, r11, r15, fail, TAG_OBJECT); + __ Allocate(rdi, r14, r11, r15, fail, NO_ALLOCATION_FLAGS); // Set backing store's map __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); __ movp(FieldOperand(r14, HeapObject::kMapOffset), rdi); @@ -296,7 +296,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( // r8 : source FixedDoubleArray // r9 : number of elements __ leap(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); - __ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); + __ Allocate(rdi, r11, r14, r15, &gc_required, NO_ALLOCATION_FLAGS); // r11: destination FixedArray __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); __ movp(FieldOperand(r11, HeapObject::kMapOffset), rdi); diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index a9d31d43bd..f753b0e1d5 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -4913,15 +4913,10 @@ void MacroAssembler::Allocate(int object_size, // Update allocation top. UpdateAllocationTopHelper(top_reg, scratch, flags); - bool tag_result = (flags & TAG_OBJECT) != 0; if (top_reg.is(result)) { - if (tag_result) { - subp(result, Immediate(object_size - kHeapObjectTag)); - } else { - subp(result, Immediate(object_size)); - } - } else if (tag_result) { - // Tag the result if requested. + subp(result, Immediate(object_size - kHeapObjectTag)); + } else { + // Tag the result. DCHECK(kHeapObjectTag == 1); incp(result); } @@ -4986,10 +4981,8 @@ void MacroAssembler::Allocate(Register object_size, // Update allocation top. UpdateAllocationTopHelper(result_end, scratch, flags); - // Tag the result if requested. - if ((flags & TAG_OBJECT) != 0) { - addp(result, Immediate(kHeapObjectTag)); - } + // Tag the result. + addp(result, Immediate(kHeapObjectTag)); } @@ -4998,7 +4991,8 @@ void MacroAssembler::AllocateHeapNumber(Register result, Label* gc_required, MutableMode mode) { // Allocate heap number in new space. - Allocate(HeapNumber::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); + Allocate(HeapNumber::kSize, result, scratch, no_reg, gc_required, + NO_ALLOCATION_FLAGS); Heap::RootListIndex map_index = mode == MUTABLE ? Heap::kMutableHeapNumberMapRootIndex @@ -5030,14 +5024,8 @@ void MacroAssembler::AllocateTwoByteString(Register result, } // Allocate two byte string in new space. - Allocate(SeqTwoByteString::kHeaderSize, - times_1, - scratch1, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1, result, scratch2, + scratch3, gc_required, NO_ALLOCATION_FLAGS); // Set the map, length and hash field. LoadRoot(kScratchRegister, Heap::kStringMapRootIndex); @@ -5066,14 +5054,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, } // Allocate one-byte string in new space. - Allocate(SeqOneByteString::kHeaderSize, - times_1, - scratch1, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1, result, scratch2, + scratch3, gc_required, NO_ALLOCATION_FLAGS); // Set the map, length and hash field. LoadRoot(kScratchRegister, Heap::kOneByteStringMapRootIndex); @@ -5091,7 +5073,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. LoadRoot(kScratchRegister, Heap::kConsStringMapRootIndex); @@ -5103,12 +5085,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. LoadRoot(kScratchRegister, Heap::kConsOneByteStringMapRootIndex); @@ -5122,7 +5100,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. LoadRoot(kScratchRegister, Heap::kSlicedStringMapRootIndex); @@ -5136,7 +5114,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. LoadRoot(kScratchRegister, Heap::kSlicedOneByteStringMapRootIndex); @@ -5152,7 +5130,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor, DCHECK(!result.is(value)); // Allocate JSValue in new space. - Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); + Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, + NO_ALLOCATION_FLAGS); // Initialize the JSValue. LoadGlobalFunctionInitialMap(constructor, scratch); diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc index 7ed29d3c2e..ab024588a5 100644 --- a/src/x87/code-stubs-x87.cc +++ b/src/x87/code-stubs-x87.cc @@ -4386,16 +4386,16 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ bind(&done_allocate); // Initialize the JSObject fields. - __ mov(Operand(eax, JSObject::kMapOffset), ecx); - __ mov(Operand(eax, JSObject::kPropertiesOffset), + __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); + __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), masm->isolate()->factory()->empty_fixed_array()); - __ mov(Operand(eax, JSObject::kElementsOffset), + __ mov(FieldOperand(eax, JSObject::kElementsOffset), masm->isolate()->factory()->empty_fixed_array()); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); - __ lea(ebx, Operand(eax, JSObject::kHeaderSize)); + __ lea(ebx, FieldOperand(eax, JSObject::kHeaderSize)); // ----------- S t a t e ------------- - // -- eax : result (untagged) + // -- eax : result (tagged) // -- ebx : result fields (untagged) // -- edi : result end (untagged) // -- ecx : initial map @@ -4413,10 +4413,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { // Initialize all in-object fields with undefined. __ LoadRoot(edx, Heap::kUndefinedValueRootIndex); __ InitializeFieldsWithFiller(ebx, edi, edx); - - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ inc(eax); __ Ret(); } __ bind(&slack_tracking); @@ -4439,10 +4435,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex); __ InitializeFieldsWithFiller(ebx, edx, edi); - // Add the object tag to make the JSObject real. - STATIC_ASSERT(kHeapObjectTag == 1); - __ inc(eax); - // Check if we can finalize the instance size. Label finalize; STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); @@ -4473,10 +4465,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) { __ CallRuntime(Runtime::kAllocateInNewSpace); __ Pop(ecx); } - STATIC_ASSERT(kHeapObjectTag == 1); - __ dec(eax); __ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset)); __ lea(edi, Operand(eax, ebx, times_pointer_size, 0)); + STATIC_ASSERT(kHeapObjectTag == 1); + __ dec(edi); __ jmp(&done_allocate); // Fall back to %NewObject. @@ -4539,7 +4531,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { // Allocate an empty rest parameter array. Label allocate, done_allocate; - __ Allocate(JSArray::kSize, eax, edx, ecx, &allocate, TAG_OBJECT); + __ Allocate(JSArray::kSize, eax, edx, ecx, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the rest parameter array in rax. @@ -4581,7 +4573,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { Label allocate, done_allocate; __ lea(ecx, Operand(eax, times_half_pointer_size, JSArray::kSize + FixedArray::kHeaderSize)); - __ Allocate(ecx, edx, edi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(ecx, edx, edi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in edx. @@ -4720,7 +4712,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { __ add(ebx, Immediate(JSSloppyArgumentsObject::kSize)); // Do the allocation of all three objects in one go. - __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); + __ Allocate(ebx, eax, edi, no_reg, &runtime, NO_ALLOCATION_FLAGS); // eax = address of new object(s) (tagged) // ecx = argument count (smi-tagged) @@ -4949,7 +4941,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { __ lea(ecx, Operand(eax, times_half_pointer_size, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); - __ Allocate(ecx, edx, edi, no_reg, &allocate, TAG_OBJECT); + __ Allocate(ecx, edx, edi, no_reg, &allocate, NO_ALLOCATION_FLAGS); __ bind(&done_allocate); // Setup the elements array in edx. diff --git a/src/x87/codegen-x87.cc b/src/x87/codegen-x87.cc index 776edeb646..06b6262a9b 100644 --- a/src/x87/codegen-x87.cc +++ b/src/x87/codegen-x87.cc @@ -275,10 +275,9 @@ void ElementsTransitionGenerator::GenerateSmiToDouble( // Allocate new FixedDoubleArray. // edx: receiver // edi: length of source FixedArray (smi-tagged) - AllocationFlags flags = - static_cast(TAG_OBJECT | DOUBLE_ALIGNMENT); __ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, - REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, flags); + REGISTER_VALUE_IS_SMI, eax, ebx, no_reg, &gc_required, + DOUBLE_ALIGNMENT); // eax: destination FixedDoubleArray // edi: number of elements @@ -391,7 +390,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( // Allocate new FixedArray. // ebx: length of source FixedDoubleArray (smi-tagged) __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); - __ Allocate(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); + __ Allocate(edi, eax, esi, no_reg, &gc_required, NO_ALLOCATION_FLAGS); // eax: destination FixedArray // ebx: number of elements diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc index 8111b06a2f..840913797c 100644 --- a/src/x87/macro-assembler-x87.cc +++ b/src/x87/macro-assembler-x87.cc @@ -1521,14 +1521,9 @@ void MacroAssembler::Allocate(int object_size, UpdateAllocationTopHelper(top_reg, scratch, flags); // Tag result if requested. - bool tag_result = (flags & TAG_OBJECT) != 0; if (top_reg.is(result)) { - if (tag_result) { - sub(result, Immediate(object_size - kHeapObjectTag)); - } else { - sub(result, Immediate(object_size)); - } - } else if (tag_result) { + sub(result, Immediate(object_size - kHeapObjectTag)); + } else { DCHECK(kHeapObjectTag == 1); inc(result); } @@ -1602,10 +1597,8 @@ void MacroAssembler::Allocate(int header_size, cmp(result_end, Operand::StaticVariable(allocation_limit)); j(above, gc_required); - if ((flags & TAG_OBJECT) != 0) { - DCHECK(kHeapObjectTag == 1); - inc(result); - } + DCHECK(kHeapObjectTag == 1); + inc(result); // Update allocation top. UpdateAllocationTopHelper(result_end, scratch, flags); @@ -1666,11 +1659,9 @@ void MacroAssembler::Allocate(Register object_size, cmp(result_end, Operand::StaticVariable(allocation_limit)); j(above, gc_required); - // Tag result if requested. - if ((flags & TAG_OBJECT) != 0) { - DCHECK(kHeapObjectTag == 1); - inc(result); - } + // Tag result. + DCHECK(kHeapObjectTag == 1); + inc(result); // Update allocation top. UpdateAllocationTopHelper(result_end, scratch, flags); @@ -1684,7 +1675,7 @@ void MacroAssembler::AllocateHeapNumber(Register result, MutableMode mode) { // Allocate heap number in new space. Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); Handle map = mode == MUTABLE ? isolate()->factory()->mutable_heap_number_map() @@ -1710,15 +1701,9 @@ void MacroAssembler::AllocateTwoByteString(Register result, and_(scratch1, Immediate(~kObjectAlignmentMask)); // Allocate two byte string in new space. - Allocate(SeqTwoByteString::kHeaderSize, - times_1, - scratch1, - REGISTER_VALUE_IS_INT32, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1, + REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required, + NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1744,15 +1729,9 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length, and_(scratch1, Immediate(~kObjectAlignmentMask)); // Allocate one-byte string in new space. - Allocate(SeqOneByteString::kHeaderSize, - times_1, - scratch1, - REGISTER_VALUE_IS_INT32, - result, - scratch2, - scratch3, - gc_required, - TAG_OBJECT); + Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1, + REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required, + NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1772,7 +1751,7 @@ void MacroAssembler::AllocateOneByteString(Register result, int length, // Allocate one-byte string in new space. Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2, - gc_required, TAG_OBJECT); + gc_required, NO_ALLOCATION_FLAGS); // Set the map, length and hash field. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1790,7 +1769,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1802,12 +1781,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register scratch1, Register scratch2, Label* gc_required) { - Allocate(ConsString::kSize, - result, - scratch1, - scratch2, - gc_required, - TAG_OBJECT); + Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1821,7 +1796,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1835,7 +1810,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result, Label* gc_required) { // Allocate heap number in new space. Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, - TAG_OBJECT); + NO_ALLOCATION_FLAGS); // Set the map. The other fields are left uninitialized. mov(FieldOperand(result, HeapObject::kMapOffset), @@ -1851,7 +1826,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor, DCHECK(!result.is(value)); // Allocate JSValue in new space. - Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); + Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, + NO_ALLOCATION_FLAGS); // Initialize the JSValue. LoadGlobalFunctionInitialMap(constructor, scratch);