Get rid of AllocationFlags::TAG_OBJECT

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

BUG=chromium:606711
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35792}
This commit is contained in:
mlippautz 2016-04-26 05:02:49 -07:00 committed by Commit bot
parent b77953b0a8
commit ef49c6b11a
39 changed files with 304 additions and 504 deletions

View File

@ -4558,15 +4558,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ str(r2, MemOperand(r0, JSObject::kMapOffset)); __ str(r2, FieldMemOperand(r0, JSObject::kMapOffset));
__ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex);
__ str(r3, MemOperand(r0, JSObject::kPropertiesOffset)); __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset));
__ str(r3, MemOperand(r0, JSObject::kElementsOffset)); __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset));
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ add(r1, r0, Operand(JSObject::kHeaderSize)); __ add(r1, r0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- r0 : result (untagged) // -- r0 : result (tagged)
// -- r1 : result fields (untagged) // -- r1 : result fields (untagged)
// -- r5 : result end (untagged) // -- r5 : result end (untagged)
// -- r2 : initial map // -- r2 : initial map
@ -4584,10 +4584,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{ {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(r1, r5, r6); __ InitializeFieldsWithFiller(r1, r5, r6);
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ add(r0, r0, Operand(kHeapObjectTag));
__ Ret(); __ Ret();
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
@ -4606,10 +4602,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex); __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(r1, r5, r6); __ 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. // Check if we can finalize the instance size.
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
__ tst(r3, Operand(Map::ConstructionCounter::kMask)); __ tst(r3, Operand(Map::ConstructionCounter::kMask));
@ -4636,10 +4628,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(r2); __ Pop(r2);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ sub(r0, r0, Operand(kHeapObjectTag));
__ ldrb(r5, FieldMemOperand(r2, Map::kInstanceSizeOffset)); __ ldrb(r5, FieldMemOperand(r2, Map::kInstanceSizeOffset));
__ add(r5, r0, Operand(r5, LSL, kPointerSizeLog2)); __ add(r5, r0, Operand(r5, LSL, kPointerSizeLog2));
STATIC_ASSERT(kHeapObjectTag == 1);
__ sub(r5, r5, Operand(kHeapObjectTag));
__ b(&done_allocate); __ b(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4702,7 +4694,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in r0. // Setup the rest parameter array in r0.
@ -4744,7 +4736,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ mov(r1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ mov(r1, Operand(JSArray::kSize + FixedArray::kHeaderSize));
__ add(r1, r1, Operand(r0, LSL, kPointerSizeLog2 - 1)); __ 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); __ bind(&done_allocate);
// Setup the elements array in r3. // Setup the elements array in r3.
@ -4876,7 +4868,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ add(r9, r9, Operand(JSSloppyArgumentsObject::kSize)); __ add(r9, r9, Operand(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // r0 = address of new object(s) (tagged)
// r2 = argument count (smi-tagged) // r2 = argument count (smi-tagged)
@ -5073,7 +5065,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ mov(r1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ mov(r1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
__ add(r1, r1, Operand(r0, LSL, kPointerSizeLog2 - 1)); __ 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); __ bind(&done_allocate);
// Setup the elements array in r3. // Setup the elements array in r3.

View File

@ -450,6 +450,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
__ mov(lr, Operand(length, LSL, 2)); __ mov(lr, Operand(length, LSL, 2));
__ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize)); __ add(lr, lr, Operand(FixedDoubleArray::kHeaderSize));
__ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT); __ Allocate(lr, array, elements, scratch2, &gc_required, DOUBLE_ALIGNMENT);
__ sub(array, array, Operand(kHeapObjectTag));
// array: destination FixedDoubleArray, not tagged as heap object. // array: destination FixedDoubleArray, not tagged as heap object.
__ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
// r4: source FixedArray. // r4: source FixedArray.
@ -594,11 +595,13 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ add(array_size, array_size, Operand(length, LSL, 1)); __ add(array_size, array_size, Operand(length, LSL, 1));
__ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required,
NO_ALLOCATION_FLAGS); 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. // Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
__ str(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); __ str(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset));
__ str(scratch, MemOperand(array, HeapObject::kMapOffset)); __ str(scratch, FieldMemOperand(array, HeapObject::kMapOffset));
__ sub(array, array, Operand(kHeapObjectTag));
// Prepare for conversion loop. // Prepare for conversion loop.
Register src_elements = elements; Register src_elements = elements;

View File

@ -2081,10 +2081,8 @@ void MacroAssembler::Allocate(int object_size,
b(hi, gc_required); b(hi, gc_required);
str(result_end, MemOperand(top_address)); str(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object.
if ((flags & TAG_OBJECT) != 0) { add(result, result, Operand(kHeapObjectTag));
add(result, result, Operand(kHeapObjectTag));
}
} }
@ -2177,10 +2175,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
} }
str(result_end, MemOperand(top_address)); str(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object.
if ((flags & TAG_OBJECT) != 0) { add(result, result, Operand(kHeapObjectTag));
add(result, result, Operand(kHeapObjectTag));
}
} }
@ -2199,12 +2195,8 @@ void MacroAssembler::AllocateTwoByteString(Register result,
and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); and_(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate two-byte string in new space. // Allocate two-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, InitializeNewString(result,
@ -2228,12 +2220,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
and_(scratch1, scratch1, Operand(~kObjectAlignmentMask)); and_(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
@ -2247,7 +2235,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -2261,12 +2249,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -2279,7 +2263,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -2295,7 +2279,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -3211,12 +3195,11 @@ void MacroAssembler::AllocateHeapNumber(Register result,
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* gc_required, Label* gc_required,
TaggingMode tagging_mode,
MutableMode mode) { MutableMode mode) {
// Allocate an object in the heap for the heap number and tag it as a heap // Allocate an object in the heap for the heap number and tag it as a heap
// object. // object.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, 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::RootListIndex map_index = mode == MUTABLE
? Heap::kMutableHeapNumberMapRootIndex ? Heap::kMutableHeapNumberMapRootIndex
@ -3224,11 +3207,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
AssertIsRoot(heap_number_map, map_index); AssertIsRoot(heap_number_map, map_index);
// Store heap number map in the allocated object. // Store heap number map in the allocated object.
if (tagging_mode == TAG_RESULT) { str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
} else {
str(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
}
} }
@ -3253,7 +3232,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);

View File

@ -816,7 +816,6 @@ class MacroAssembler: public Assembler {
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* gc_required, Label* gc_required,
TaggingMode tagging_mode = TAG_RESULT,
MutableMode mode = IMMUTABLE); MutableMode mode = IMMUTABLE);
void AllocateHeapNumberWithValue(Register result, void AllocateHeapNumberWithValue(Register result,
DwVfpRegister value, DwVfpRegister value,

View File

@ -4824,17 +4824,18 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ Bind(&done_allocate); __ Bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ Mov(x1, x0);
STATIC_ASSERT(JSObject::kMapOffset == 0 * kPointerSize); STATIC_ASSERT(JSObject::kMapOffset == 0 * kPointerSize);
__ Str(x2, MemOperand(x1, kPointerSize, PostIndex)); __ Str(x2, FieldMemOperand(x0, JSObject::kMapOffset));
__ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex);
STATIC_ASSERT(JSObject::kPropertiesOffset == 1 * kPointerSize); STATIC_ASSERT(JSObject::kPropertiesOffset == 1 * kPointerSize);
STATIC_ASSERT(JSObject::kElementsOffset == 2 * 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); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ Add(x1, x0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- x0 : result (untagged) // -- x0 : result (tagged)
// -- x1 : result fields (untagged) // -- x1 : result fields (untagged)
// -- x5 : result end (untagged) // -- x5 : result end (untagged)
// -- x2 : initial map // -- x2 : initial map
@ -4852,10 +4853,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{ {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(x1, x5, x6); __ InitializeFieldsWithFiller(x1, x5, x6);
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ Add(x0, x0, kHeapObjectTag);
__ Ret(); __ Ret();
} }
__ Bind(&slack_tracking); __ Bind(&slack_tracking);
@ -4874,10 +4871,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(x6, Heap::kOnePointerFillerMapRootIndex); __ LoadRoot(x6, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(x1, x5, x6); __ 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. // Check if we can finalize the instance size.
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
@ -4907,10 +4900,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(x2); __ Pop(x2);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ Sub(x0, x0, kHeapObjectTag);
__ Ldrb(x5, FieldMemOperand(x2, Map::kInstanceSizeOffset)); __ Ldrb(x5, FieldMemOperand(x2, Map::kInstanceSizeOffset));
__ Add(x5, x0, Operand(x5, LSL, kPointerSizeLog2)); __ Add(x5, x0, Operand(x5, LSL, kPointerSizeLog2));
STATIC_ASSERT(kHeapObjectTag == 1);
__ Sub(x5, x5, kHeapObjectTag); // Subtract the tag from end.
__ B(&done_allocate); __ B(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4974,7 +4967,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ Bind(&done_allocate);
// Setup the rest parameter array in x0. // Setup the rest parameter array in x0.
@ -5015,7 +5008,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ Mov(x1, JSArray::kSize + FixedArray::kHeaderSize); __ Mov(x1, JSArray::kSize + FixedArray::kHeaderSize);
__ Add(x1, x1, Operand(x0, LSL, kPointerSizeLog2)); __ 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); __ Bind(&done_allocate);
// Compute arguments.length in x6. // 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 // Do the allocation of all three objects in one go. Assign this to x0, as it
// will be returned to the caller. // will be returned to the caller.
Register alloc_obj = x0; 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. // Get the arguments boilerplate from the current (global) context.
@ -5426,7 +5419,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ Mov(x1, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize); __ Mov(x1, JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize);
__ Add(x1, x1, Operand(x0, LSL, kPointerSizeLog2)); __ 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); __ Bind(&done_allocate);
// Compute arguments.length in x6. // Compute arguments.length in x6.

View File

@ -175,8 +175,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
Register map_root = array_size; Register map_root = array_size;
__ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex);
__ SmiTag(x11, length); __ SmiTag(x11, length);
__ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset));
__ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset));
__ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch, __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, scratch,
@ -184,18 +184,18 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
OMIT_SMI_CHECK); OMIT_SMI_CHECK);
// Replace receiver's backing store with newly created FixedDoubleArray. // Replace receiver's backing store with newly created FixedDoubleArray.
__ Add(x10, array, kHeapObjectTag); __ Move(x10, array);
__ Str(x10, FieldMemOperand(receiver, JSObject::kElementsOffset)); __ Str(array, FieldMemOperand(receiver, JSObject::kElementsOffset));
__ RecordWriteField(receiver, JSObject::kElementsOffset, x10, __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, scratch,
scratch, kLRHasBeenSaved, kDontSaveFPRegs, kLRHasBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); OMIT_SMI_CHECK);
// Prepare for conversion loop. // Prepare for conversion loop.
Register src_elements = x10; Register src_elements = x10;
Register dst_elements = x11; Register dst_elements = x11;
Register dst_end = x12; Register dst_end = x12;
__ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); __ 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)); __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2));
FPRegister nan_d = d1; FPRegister nan_d = d1;
@ -282,8 +282,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
Register map_root = array_size; Register map_root = array_size;
__ LoadRoot(map_root, Heap::kFixedArrayMapRootIndex); __ LoadRoot(map_root, Heap::kFixedArrayMapRootIndex);
__ SmiTag(x11, length); __ SmiTag(x11, length);
__ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); __ Str(x11, FieldMemOperand(array, FixedDoubleArray::kLengthOffset));
__ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); __ Str(map_root, FieldMemOperand(array, HeapObject::kMapOffset));
// Prepare for conversion loop. // Prepare for conversion loop.
Register src_elements = x10; Register src_elements = x10;
@ -293,7 +293,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex);
__ Add(src_elements, elements, __ Add(src_elements, elements,
FixedDoubleArray::kHeaderSize - kHeapObjectTag); 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)); __ Add(dst_end, dst_elements, Operand(length, LSL, kPointerSizeLog2));
// Allocating heap numbers in the loop below can fail and cause a jump to // 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); __ Cmp(dst_elements, dst_end);
__ B(lt, &initialization_loop); __ B(lt, &initialization_loop);
__ Add(dst_elements, array, FixedArray::kHeaderSize); __ Add(dst_elements, array, FixedArray::kHeaderSize - kHeapObjectTag);
__ Add(array, array, kHeapObjectTag);
Register heap_num_map = x15; Register heap_num_map = x15;
__ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex); __ LoadRoot(heap_num_map, Heap::kHeapNumberMapRootIndex);

View File

@ -3094,10 +3094,8 @@ void MacroAssembler::Allocate(int object_size,
B(hi, gc_required); B(hi, gc_required);
Str(result_end, MemOperand(top_address)); Str(result_end, MemOperand(top_address));
// Tag the object if requested. // Tag the object.
if ((flags & TAG_OBJECT) != 0) { ObjectTag(result, result);
ObjectTag(result, result);
}
} }
@ -3174,10 +3172,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
B(hi, gc_required); B(hi, gc_required);
Str(result_end, MemOperand(top_address)); Str(result_end, MemOperand(top_address));
// Tag the object if requested. // Tag the object.
if ((flags & TAG_OBJECT) != 0) { ObjectTag(result, result);
ObjectTag(result, result);
}
} }
@ -3196,12 +3192,8 @@ void MacroAssembler::AllocateTwoByteString(Register result,
Bic(scratch1, scratch1, kObjectAlignmentMask); Bic(scratch1, scratch1, kObjectAlignmentMask);
// Allocate two-byte string in new space. // Allocate two-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, InitializeNewString(result,
@ -3225,12 +3217,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
Bic(scratch1, scratch1, kObjectAlignmentMask); Bic(scratch1, scratch1, kObjectAlignmentMask);
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
@ -3244,7 +3232,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -3258,12 +3246,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -3277,7 +3261,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
DCHECK(!AreAliased(result, length, scratch1, scratch2)); DCHECK(!AreAliased(result, length, scratch1, scratch2));
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -3294,7 +3278,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
DCHECK(!AreAliased(result, length, scratch1, scratch2)); DCHECK(!AreAliased(result, length, scratch1, scratch2));
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -3348,14 +3332,14 @@ void MacroAssembler::AllocateHeapNumber(Register result,
if (value.IsSameSizeAndType(heap_number_map)) { if (value.IsSameSizeAndType(heap_number_map)) {
STATIC_ASSERT(HeapObject::kMapOffset + kPointerSize == STATIC_ASSERT(HeapObject::kMapOffset + kPointerSize ==
HeapNumber::kValueOffset); HeapNumber::kValueOffset);
Stp(heap_number_map, value, MemOperand(result, HeapObject::kMapOffset)); Stp(heap_number_map, value,
FieldMemOperand(result, HeapObject::kMapOffset));
} else { } else {
Str(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); Str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
if (value.IsValid()) { 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)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);

View File

@ -4496,7 +4496,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex);
__ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, DONT_TAG_RESULT); __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow);
__ b(&done); __ b(&done);
} }
@ -4520,15 +4520,13 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
RecordSafepointWithRegisters( RecordSafepointWithRegisters(
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
__ sub(r0, r0, Operand(kHeapObjectTag));
__ StoreToSafepointRegisterSlot(r0, dst); __ StoreToSafepointRegisterSlot(r0, dst);
} }
// Done. Put the value in dbl_scratch into the value of the allocated heap // Done. Put the value in dbl_scratch into the value of the allocated heap
// number. // number.
__ bind(&done); __ bind(&done);
__ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); __ vstr(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset));
__ add(dst, dst, Operand(kHeapObjectTag));
} }
@ -4553,16 +4551,12 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
// We want the untagged address first for performance __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
__ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(),
DONT_TAG_RESULT);
} else { } else {
__ jmp(deferred->entry()); __ jmp(deferred->entry());
} }
__ bind(deferred->exit()); __ bind(deferred->exit());
__ vstr(input_reg, reg, HeapNumber::kValueOffset); __ vstr(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset));
// Now that we have finished with the object's real address tag it
__ add(reg, reg, Operand(kHeapObjectTag));
} }
@ -4583,7 +4577,6 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
RecordSafepointWithRegisters( RecordSafepointWithRegisters(
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
__ sub(r0, r0, Operand(kHeapObjectTag));
__ StoreToSafepointRegisterSlot(r0, reg); __ StoreToSafepointRegisterSlot(r0, reg);
} }
@ -5107,7 +5100,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
Register scratch2 = ToRegister(instr->temp2()); Register scratch2 = ToRegister(instr->temp2());
// Allocate memory for the object. // Allocate memory for the object.
AllocationFlags flags = TAG_OBJECT; AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) { if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
} }

View File

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

View File

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

View File

@ -4439,7 +4439,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex);
__ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, DONT_TAG_RESULT); __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow);
__ Branch(&done); __ Branch(&done);
} }
@ -4463,16 +4463,13 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
RecordSafepointWithRegisters( RecordSafepointWithRegisters(
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
__ Subu(v0, v0, kHeapObjectTag);
__ StoreToSafepointRegisterSlot(v0, dst); __ StoreToSafepointRegisterSlot(v0, dst);
} }
// Done. Put the value in dbl_scratch into the value of the allocated heap // Done. Put the value in dbl_scratch into the value of the allocated heap
// number. // number.
__ bind(&done); __ bind(&done);
__ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset)); __ sdc1(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset));
__ Addu(dst, dst, kHeapObjectTag);
} }
@ -4497,16 +4494,13 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
// We want the untagged address first for performance __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
__ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(),
DONT_TAG_RESULT);
} else { } else {
__ Branch(deferred->entry()); __ Branch(deferred->entry());
} }
__ bind(deferred->exit()); __ 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 // 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); __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
RecordSafepointWithRegisters( RecordSafepointWithRegisters(
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
__ Subu(v0, v0, kHeapObjectTag);
__ StoreToSafepointRegisterSlot(v0, reg); __ StoreToSafepointRegisterSlot(v0, reg);
} }
@ -5075,7 +5068,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
Register scratch2 = ToRegister(instr->temp2()); Register scratch2 = ToRegister(instr->temp2());
// Allocate memory for the object. // Allocate memory for the object.
AllocationFlags flags = TAG_OBJECT; AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) { if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
} }

View File

@ -4645,7 +4645,7 @@ void LCodeGen::DoDeferredNumberTagIU(LInstruction* instr,
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex); __ LoadRoot(tmp3, Heap::kHeapNumberMapRootIndex);
__ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow, TAG_RESULT); __ AllocateHeapNumber(dst, tmp1, tmp2, tmp3, &slow);
__ Branch(&done); __ Branch(&done);
} }
@ -4700,15 +4700,12 @@ void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
if (FLAG_inline_new) { if (FLAG_inline_new) {
__ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
// We want the untagged address first for performance // We want the untagged address first for performance
__ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry());
DONT_TAG_RESULT);
} else { } else {
__ Branch(deferred->entry()); __ Branch(deferred->entry());
} }
__ bind(deferred->exit()); __ 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
__ Daddu(reg, reg, kHeapObjectTag);
} }
@ -4729,7 +4726,6 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
__ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
RecordSafepointWithRegisters( RecordSafepointWithRegisters(
instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
__ Dsubu(v0, v0, kHeapObjectTag);
__ StoreToSafepointRegisterSlot(v0, reg); __ StoreToSafepointRegisterSlot(v0, reg);
} }
@ -5276,7 +5272,7 @@ void LCodeGen::DoAllocate(LAllocate* instr) {
Register scratch2 = ToRegister(instr->temp2()); Register scratch2 = ToRegister(instr->temp2());
// Allocate memory for the object. // Allocate memory for the object.
AllocationFlags flags = TAG_OBJECT; AllocationFlags flags = NO_ALLOCATION_FLAGS;
if (instr->hydrogen()->MustAllocateDoubleAligned()) { if (instr->hydrogen()->MustAllocateDoubleAligned()) {
flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT); flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
} }

View File

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

View File

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

View File

@ -1898,7 +1898,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ b(&done_allocate);
__ bind(&allocate); __ bind(&allocate);
@ -3194,7 +3195,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r1);
__ pop(r3); __ pop(r3);
__ pop(r2); __ pop(r2);

View File

@ -3100,7 +3100,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; Label runtime, done;
Register result = x0; 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 map_reg = x1;
Register result_value = x2; Register result_value = x2;
Register boolean_done = x3; 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 } // Allocate and populate an object with this form: { value: VAL, done: DONE }
Register result = x0; 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); __ B(&done_allocate);
__ Bind(&allocate); __ Bind(&allocate);

View File

@ -1811,7 +1811,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ jmp(&done_allocate, Label::kNear);
__ bind(&allocate); __ bind(&allocate);
@ -3095,7 +3096,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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, NativeContextOperand());
__ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
__ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);

View File

@ -1902,7 +1902,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ jmp(&done_allocate);
__ bind(&allocate); __ bind(&allocate);
@ -3214,7 +3215,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1);
__ Pop(a2, a3); __ Pop(a2, a3);
__ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex);

View File

@ -1903,7 +1903,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ jmp(&done_allocate);
__ bind(&allocate); __ bind(&allocate);
@ -3214,7 +3215,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1);
__ Pop(a2, a3); __ Pop(a2, a3);
__ LoadRoot(a4, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(a4, Heap::kEmptyFixedArrayRootIndex);

View File

@ -1836,7 +1836,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ jmp(&done_allocate, Label::kNear);
__ bind(&allocate); __ bind(&allocate);
@ -3083,7 +3084,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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); __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, rbx);
__ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx);
__ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);

View File

@ -1803,7 +1803,8 @@ void FullCodeGenerator::EmitOperandStackDepthCheck() {
void FullCodeGenerator::EmitCreateIteratorResult(bool done) { void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
Label allocate, done_allocate; 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); __ jmp(&done_allocate, Label::kNear);
__ bind(&allocate); __ bind(&allocate);
@ -3087,7 +3088,8 @@ void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
Label runtime, done; 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, NativeContextOperand());
__ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
__ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);

View File

@ -4714,16 +4714,16 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ mov(Operand(eax, JSObject::kMapOffset), ecx); __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx);
__ mov(Operand(eax, JSObject::kPropertiesOffset), __ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
masm->isolate()->factory()->empty_fixed_array()); masm->isolate()->factory()->empty_fixed_array());
__ mov(Operand(eax, JSObject::kElementsOffset), __ mov(FieldOperand(eax, JSObject::kElementsOffset),
masm->isolate()->factory()->empty_fixed_array()); masm->isolate()->factory()->empty_fixed_array());
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ lea(ebx, Operand(eax, JSObject::kHeaderSize)); __ lea(ebx, FieldOperand(eax, JSObject::kHeaderSize));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : result (untagged) // -- eax : result (tagged)
// -- ebx : result fields (untagged) // -- ebx : result fields (untagged)
// -- edi : result end (untagged) // -- edi : result end (untagged)
// -- ecx : initial map // -- ecx : initial map
@ -4741,10 +4741,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ LoadRoot(edx, Heap::kUndefinedValueRootIndex); __ LoadRoot(edx, Heap::kUndefinedValueRootIndex);
__ InitializeFieldsWithFiller(ebx, edi, edx); __ InitializeFieldsWithFiller(ebx, edi, edx);
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ inc(eax);
__ Ret(); __ Ret();
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
@ -4767,10 +4763,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex); __ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(ebx, edx, edi); __ 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. // Check if we can finalize the instance size.
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
@ -4801,10 +4793,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(ecx); __ Pop(ecx);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ dec(eax);
__ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset)); __ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset));
__ lea(edi, Operand(eax, ebx, times_pointer_size, 0)); __ lea(edi, Operand(eax, ebx, times_pointer_size, 0));
STATIC_ASSERT(kHeapObjectTag == 1);
__ dec(edi);
__ jmp(&done_allocate); __ jmp(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4868,7 +4860,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in rax. // Setup the rest parameter array in rax.
@ -4910,7 +4902,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ lea(ecx, Operand(eax, times_half_pointer_size, __ lea(ecx, Operand(eax, times_half_pointer_size,
JSArray::kSize + FixedArray::kHeaderSize)); 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); __ bind(&done_allocate);
// Setup the elements array in edx. // Setup the elements array in edx.
@ -5050,7 +5042,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ add(ebx, Immediate(JSSloppyArgumentsObject::kSize)); __ add(ebx, Immediate(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // eax = address of new object(s) (tagged)
// ecx = argument count (smi-tagged) // ecx = argument count (smi-tagged)
@ -5280,7 +5272,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
__ lea(ecx, __ lea(ecx,
Operand(eax, times_half_pointer_size, Operand(eax, times_half_pointer_size,
JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); 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); __ bind(&done_allocate);
// Setup the elements array in edx. // Setup the elements array in edx.

View File

@ -586,8 +586,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
// Allocate new FixedDoubleArray. // Allocate new FixedDoubleArray.
// edx: receiver // edx: receiver
// edi: length of source FixedArray (smi-tagged) // edi: length of source FixedArray (smi-tagged)
AllocationFlags flags = AllocationFlags flags = static_cast<AllocationFlags>(DOUBLE_ALIGNMENT);
static_cast<AllocationFlags>(TAG_OBJECT | DOUBLE_ALIGNMENT);
__ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, __ 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, flags);
@ -714,7 +713,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
// Allocate new FixedArray. // Allocate new FixedArray.
// ebx: length of source FixedDoubleArray (smi-tagged) // ebx: length of source FixedDoubleArray (smi-tagged)
__ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); __ 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 // eax: destination FixedArray
// ebx: number of elements // ebx: number of elements

View File

@ -1578,15 +1578,10 @@ void MacroAssembler::Allocate(int object_size,
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(top_reg, scratch, flags); UpdateAllocationTopHelper(top_reg, scratch, flags);
// Tag result if requested.
bool tag_result = (flags & TAG_OBJECT) != 0;
if (top_reg.is(result)) { if (top_reg.is(result)) {
if (tag_result) { sub(result, Immediate(object_size - kHeapObjectTag));
sub(result, Immediate(object_size - kHeapObjectTag)); } else {
} else { // Tag the result.
sub(result, Immediate(object_size));
}
} else if (tag_result) {
DCHECK(kHeapObjectTag == 1); DCHECK(kHeapObjectTag == 1);
inc(result); inc(result);
} }
@ -1660,10 +1655,9 @@ void MacroAssembler::Allocate(int header_size,
cmp(result_end, Operand::StaticVariable(allocation_limit)); cmp(result_end, Operand::StaticVariable(allocation_limit));
j(above, gc_required); j(above, gc_required);
if ((flags & TAG_OBJECT) != 0) { // Tag result.
DCHECK(kHeapObjectTag == 1); DCHECK(kHeapObjectTag == 1);
inc(result); inc(result);
}
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(result_end, scratch, flags); UpdateAllocationTopHelper(result_end, scratch, flags);
@ -1724,11 +1718,9 @@ void MacroAssembler::Allocate(Register object_size,
cmp(result_end, Operand::StaticVariable(allocation_limit)); cmp(result_end, Operand::StaticVariable(allocation_limit));
j(above, gc_required); j(above, gc_required);
// Tag result if requested. // Tag result.
if ((flags & TAG_OBJECT) != 0) { DCHECK(kHeapObjectTag == 1);
DCHECK(kHeapObjectTag == 1); inc(result);
inc(result);
}
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(result_end, scratch, flags); UpdateAllocationTopHelper(result_end, scratch, flags);
@ -1742,7 +1734,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
MutableMode mode) { MutableMode mode) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
Handle<Map> map = mode == MUTABLE Handle<Map> map = mode == MUTABLE
? isolate()->factory()->mutable_heap_number_map() ? isolate()->factory()->mutable_heap_number_map()
@ -1768,15 +1760,9 @@ void MacroAssembler::AllocateTwoByteString(Register result,
and_(scratch1, Immediate(~kObjectAlignmentMask)); and_(scratch1, Immediate(~kObjectAlignmentMask));
// Allocate two byte string in new space. // Allocate two byte string in new space.
Allocate(SeqTwoByteString::kHeaderSize, Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1,
times_1, REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
scratch1, NO_ALLOCATION_FLAGS);
REGISTER_VALUE_IS_INT32,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1802,15 +1788,9 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
and_(scratch1, Immediate(~kObjectAlignmentMask)); and_(scratch1, Immediate(~kObjectAlignmentMask));
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(SeqOneByteString::kHeaderSize, Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1,
times_1, REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
scratch1, NO_ALLOCATION_FLAGS);
REGISTER_VALUE_IS_INT32,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1830,7 +1810,7 @@ void MacroAssembler::AllocateOneByteString(Register result, int length,
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2, Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2,
gc_required, TAG_OBJECT); gc_required, NO_ALLOCATION_FLAGS);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1848,7 +1828,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1860,12 +1840,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1879,7 +1855,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1893,7 +1869,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1909,7 +1885,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch); LoadGlobalFunctionInitialMap(constructor, scratch);

View File

@ -19,21 +19,18 @@ enum InvokeFlag {
enum AllocationFlags { enum AllocationFlags {
// No special flags. // No special flags.
NO_ALLOCATION_FLAGS = 0, 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 // The content of the result register already contains the allocation top in
// new space. // 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 // Specify that the requested size of the space to allocate is specified in
// words instead of bytes. // words instead of bytes.
SIZE_IN_WORDS = 1 << 2, SIZE_IN_WORDS = 1 << 1,
// Align the allocation to a multiple of kDoubleSize // Align the allocation to a multiple of kDoubleSize
DOUBLE_ALIGNMENT = 1 << 3, DOUBLE_ALIGNMENT = 1 << 2,
// Directly allocate in old space // Directly allocate in old space
PRETENURE = 1 << 4, PRETENURE = 1 << 3,
}; };
#if V8_TARGET_ARCH_IA32 #if V8_TARGET_ARCH_IA32
#include "src/ia32/assembler-ia32.h" #include "src/ia32/assembler-ia32.h"
#include "src/ia32/assembler-ia32-inl.h" #include "src/ia32/assembler-ia32-inl.h"

View File

@ -4748,15 +4748,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ sw(a2, MemOperand(v0, JSObject::kMapOffset)); __ sw(a2, FieldMemOperand(v0, JSObject::kMapOffset));
__ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
__ sw(a3, MemOperand(v0, JSObject::kPropertiesOffset)); __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset));
__ sw(a3, MemOperand(v0, JSObject::kElementsOffset)); __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ Addu(a1, v0, Operand(JSObject::kHeaderSize)); __ Addu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- v0 : result (untagged) // -- v0 : result (tagged)
// -- a1 : result fields (untagged) // -- a1 : result fields (untagged)
// -- t1 : result end (untagged) // -- t1 : result end (untagged)
// -- a2 : initial map // -- a2 : initial map
@ -4774,11 +4774,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{ {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(a1, t1, a0); __ InitializeFieldsWithFiller(a1, t1, a0);
__ Ret();
// 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.
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
{ {
@ -4801,9 +4797,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
__ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); __ And(a3, a3, Operand(Map::ConstructionCounter::kMask));
__ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); __ Branch(&finalize, eq, a3, Operand(zero_reg));
STATIC_ASSERT(kHeapObjectTag == 1);
__ Addu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
__ Ret(); __ Ret();
// Finalize the instance size. // Finalize the instance size.
@ -4828,10 +4822,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(a2); __ Pop(a2);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ Subu(v0, v0, Operand(kHeapObjectTag));
__ lbu(t1, FieldMemOperand(a2, Map::kInstanceSizeOffset)); __ lbu(t1, FieldMemOperand(a2, Map::kInstanceSizeOffset));
__ Lsa(t1, v0, t1, kPointerSizeLog2); __ Lsa(t1, v0, t1, kPointerSizeLog2);
STATIC_ASSERT(kHeapObjectTag == 1);
__ Subu(t1, t1, Operand(kHeapObjectTag));
__ jmp(&done_allocate); __ jmp(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4893,7 +4887,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in v0. // Setup the rest parameter array in v0.
@ -4935,7 +4929,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize));
__ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); __ 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); __ bind(&done_allocate);
// Setup the elements array in v0. // Setup the elements array in v0.
@ -5069,7 +5063,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize)); __ Addu(t5, t5, Operand(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // v0 = address of new object(s) (tagged)
// a2 = argument count (smi-tagged) // a2 = argument count (smi-tagged)
@ -5271,7 +5265,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
__ Lsa(a1, a1, a0, kPointerSizeLog2 - 1); __ 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); __ bind(&done_allocate);
// Setup the elements array in v0. // Setup the elements array in v0.

View File

@ -733,13 +733,13 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
__ sll(scratch, length, 2); __ sll(scratch, length, 2);
__ Addu(scratch, scratch, FixedDoubleArray::kHeaderSize); __ Addu(scratch, scratch, FixedDoubleArray::kHeaderSize);
__ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT); __ 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. // Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex); __ LoadRoot(scratch2, Heap::kFixedDoubleArrayMapRootIndex);
__ sw(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset));
// Update receiver's map. // Update receiver's map.
__ sw(scratch2, MemOperand(array, HeapObject::kMapOffset)); __ sw(scratch2, FieldMemOperand(array, HeapObject::kMapOffset));
__ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); __ sw(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ RecordWriteField(receiver, __ RecordWriteField(receiver,
@ -751,7 +751,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
OMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK); OMIT_SMI_CHECK);
// Replace receiver's backing store with newly created FixedDoubleArray. // 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)); __ sw(scratch1, FieldMemOperand(receiver, JSObject::kElementsOffset));
__ RecordWriteField(receiver, __ RecordWriteField(receiver,
JSObject::kElementsOffset, JSObject::kElementsOffset,
@ -766,7 +766,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
// Prepare for conversion loop. // Prepare for conversion loop.
__ Addu(scratch1, elements, __ Addu(scratch1, elements,
Operand(FixedArray::kHeaderSize - kHeapObjectTag)); Operand(FixedArray::kHeaderSize - kHeapObjectTag));
__ Addu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); __ Addu(scratch3, array,
Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
__ Lsa(array_end, scratch3, length, 2); __ Lsa(array_end, scratch3, length, 2);
// Repurpose registers no longer in use. // Repurpose registers no longer in use.
@ -886,8 +887,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
// array: destination FixedArray, not tagged as heap object // array: destination FixedArray, not tagged as heap object
// Set destination FixedDoubleArray's length and map. // Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
__ sw(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); __ sw(length, FieldMemOperand(array, FixedDoubleArray::kLengthOffset));
__ sw(scratch, MemOperand(array, HeapObject::kMapOffset)); __ sw(scratch, FieldMemOperand(array, HeapObject::kMapOffset));
// Prepare for conversion loop. // Prepare for conversion loop.
Register src_elements = elements; Register src_elements = elements;
@ -897,7 +898,8 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ Addu(src_elements, src_elements, Operand( __ Addu(src_elements, src_elements, Operand(
FixedDoubleArray::kHeaderSize - kHeapObjectTag FixedDoubleArray::kHeaderSize - kHeapObjectTag
+ Register::kExponentOffset)); + 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); __ Lsa(dst_end, dst_elements, dst_end, 1);
// Allocating heap numbers in the loop below can fail and cause a jump to // 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); __ bind(&initialization_loop_entry);
__ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end)); __ Branch(&initialization_loop, lt, dst_elements, Operand(dst_end));
__ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); __ Addu(dst_elements, array,
__ Addu(array, array, Operand(kHeapObjectTag)); Operand(FixedArray::kHeaderSize - kHeapObjectTag));
__ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
// Using offsetted addresses. // Using offsetted addresses.
// dst_elements: begin of destination FixedArray element fields, not tagged // dst_elements: begin of destination FixedArray element fields, not tagged

View File

@ -3974,10 +3974,8 @@ void MacroAssembler::Allocate(int object_size,
Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
sw(result_end, MemOperand(top_address)); sw(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object.
if ((flags & TAG_OBJECT) != 0) { Addu(result, result, Operand(kHeapObjectTag));
Addu(result, result, Operand(kHeapObjectTag));
}
} }
@ -4065,10 +4063,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
} }
sw(result_end, MemOperand(top_address)); sw(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object.
if ((flags & TAG_OBJECT) != 0) { Addu(result, result, Operand(kHeapObjectTag));
Addu(result, result, Operand(kHeapObjectTag));
}
} }
@ -4087,12 +4083,8 @@ void MacroAssembler::AllocateTwoByteString(Register result,
And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); And(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate two-byte string in new space. // Allocate two-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, InitializeNewString(result,
@ -4115,12 +4107,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); And(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
@ -4134,7 +4122,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
Heap::kConsStringMapRootIndex, Heap::kConsStringMapRootIndex,
@ -4147,12 +4135,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -4165,7 +4149,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -4181,7 +4165,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -4207,12 +4191,11 @@ void MacroAssembler::AllocateHeapNumber(Register result,
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* need_gc, Label* need_gc,
TaggingMode tagging_mode,
MutableMode mode) { MutableMode mode) {
// Allocate an object in the heap for the heap number and tag it as a heap // Allocate an object in the heap for the heap number and tag it as a heap
// object. // object.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, need_gc, 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::RootListIndex map_index = mode == MUTABLE
? Heap::kMutableHeapNumberMapRootIndex ? Heap::kMutableHeapNumberMapRootIndex
@ -4220,11 +4203,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
AssertIsRoot(heap_number_map, map_index); AssertIsRoot(heap_number_map, map_index);
// Store heap number map in the allocated object. // Store heap number map in the allocated object.
if (tagging_mode == TAG_RESULT) { sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
} else {
sw(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
}
} }
@ -4248,7 +4227,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);

View File

@ -588,7 +588,6 @@ class MacroAssembler: public Assembler {
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* gc_required, Label* gc_required,
TaggingMode tagging_mode = TAG_RESULT,
MutableMode mode = IMMUTABLE); MutableMode mode = IMMUTABLE);
void AllocateHeapNumberWithValue(Register result, void AllocateHeapNumberWithValue(Register result,
FPURegister value, FPURegister value,

View File

@ -4758,15 +4758,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ sd(a2, MemOperand(v0, JSObject::kMapOffset)); __ sd(a2, FieldMemOperand(v0, JSObject::kMapOffset));
__ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex);
__ sd(a3, MemOperand(v0, JSObject::kPropertiesOffset)); __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset));
__ sd(a3, MemOperand(v0, JSObject::kElementsOffset)); __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ Daddu(a1, v0, Operand(JSObject::kHeaderSize)); __ Daddu(a1, v0, Operand(JSObject::kHeaderSize - kHeapObjectTag));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- v0 : result (untagged) // -- v0 : result (tagged)
// -- a1 : result fields (untagged) // -- a1 : result fields (untagged)
// -- a5 : result end (untagged) // -- a5 : result end (untagged)
// -- a2 : initial map // -- a2 : initial map
@ -4784,11 +4784,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{ {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(a1, a5, a0); __ InitializeFieldsWithFiller(a1, a5, a0);
__ Ret();
// 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.
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
{ {
@ -4811,9 +4807,7 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
__ And(a3, a3, Operand(Map::ConstructionCounter::kMask)); __ And(a3, a3, Operand(Map::ConstructionCounter::kMask));
__ Branch(USE_DELAY_SLOT, &finalize, eq, a3, Operand(zero_reg)); __ Branch(&finalize, eq, a3, Operand(zero_reg));
STATIC_ASSERT(kHeapObjectTag == 1);
__ Daddu(v0, v0, Operand(kHeapObjectTag)); // In delay slot.
__ Ret(); __ Ret();
// Finalize the instance size. // Finalize the instance size.
@ -4839,10 +4833,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(a2); __ Pop(a2);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ Dsubu(v0, v0, Operand(kHeapObjectTag));
__ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset)); __ lbu(a5, FieldMemOperand(a2, Map::kInstanceSizeOffset));
__ Dlsa(a5, v0, a5, kPointerSizeLog2); __ Dlsa(a5, v0, a5, kPointerSizeLog2);
STATIC_ASSERT(kHeapObjectTag == 1);
__ Dsubu(a5, a5, Operand(kHeapObjectTag));
__ jmp(&done_allocate); __ jmp(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4905,7 +4899,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in v0. // Setup the rest parameter array in v0.
@ -4947,7 +4941,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize)); __ li(a1, Operand(JSArray::kSize + FixedArray::kHeaderSize));
__ Dlsa(a1, a1, a0, kPointerSizeLog2); __ 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); __ bind(&done_allocate);
// Compute arguments.length in a4. // Compute arguments.length in a4.
@ -5088,7 +5082,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize)); __ Daddu(t1, t1, Operand(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // v0 = address of new object(s) (tagged)
// a2 = argument count (smi-tagged) // a2 = argument count (smi-tagged)
@ -5294,7 +5288,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); __ li(a1, Operand(JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize));
__ Dlsa(a1, a1, a0, kPointerSizeLog2); __ 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); __ bind(&done_allocate);
// Compute arguments.length in a4. // Compute arguments.length in a4.

View File

@ -732,6 +732,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
__ SmiScale(scratch, length, kDoubleSizeLog2); __ SmiScale(scratch, length, kDoubleSizeLog2);
__ Daddu(scratch, scratch, FixedDoubleArray::kHeaderSize); __ Daddu(scratch, scratch, FixedDoubleArray::kHeaderSize);
__ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT); __ Allocate(scratch, array, t3, scratch2, &gc_required, DOUBLE_ALIGNMENT);
__ Dsubu(array, array, kHeapObjectTag);
// array: destination FixedDoubleArray, not tagged as heap object // array: destination FixedDoubleArray, not tagged as heap object
// Set destination FixedDoubleArray's length and map. // Set destination FixedDoubleArray's length and map.
@ -882,6 +883,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
__ Daddu(array_size, array_size, FixedDoubleArray::kHeaderSize); __ Daddu(array_size, array_size, FixedDoubleArray::kHeaderSize);
__ Allocate(array_size, array, allocate_scratch, scratch, &gc_required, __ Allocate(array_size, array, allocate_scratch, scratch, &gc_required,
NO_ALLOCATION_FLAGS); NO_ALLOCATION_FLAGS);
__ Dsubu(array, array, kHeapObjectTag);
// array: destination FixedArray, not tagged as heap object // array: destination FixedArray, not tagged as heap object
// Set destination FixedDoubleArray's length and map. // Set destination FixedDoubleArray's length and map.
__ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);

View File

@ -4144,10 +4144,8 @@ void MacroAssembler::Allocate(int object_size,
Branch(gc_required, Ugreater, result_end, Operand(alloc_limit)); Branch(gc_required, Ugreater, result_end, Operand(alloc_limit));
sd(result_end, MemOperand(top_address)); sd(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object.
if ((flags & TAG_OBJECT) != 0) { Daddu(result, result, Operand(kHeapObjectTag));
Daddu(result, result, Operand(kHeapObjectTag));
}
} }
@ -4226,10 +4224,8 @@ void MacroAssembler::Allocate(Register object_size, Register result,
} }
sd(result_end, MemOperand(top_address)); sd(result_end, MemOperand(top_address));
// Tag object if requested. // Tag object if.
if ((flags & TAG_OBJECT) != 0) { Daddu(result, result, Operand(kHeapObjectTag));
Daddu(result, result, Operand(kHeapObjectTag));
}
} }
@ -4248,12 +4244,8 @@ void MacroAssembler::AllocateTwoByteString(Register result,
And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); And(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate two-byte string in new space. // Allocate two-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, InitializeNewString(result,
@ -4277,12 +4269,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
And(scratch1, scratch1, Operand(~kObjectAlignmentMask)); And(scratch1, scratch1, Operand(~kObjectAlignmentMask));
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(scratch1, Allocate(scratch1, result, scratch2, scratch3, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
@ -4296,7 +4284,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
Heap::kConsStringMapRootIndex, Heap::kConsStringMapRootIndex,
@ -4309,12 +4297,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -4327,7 +4311,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, InitializeNewString(result,
length, length,
@ -4343,7 +4327,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
scratch1, scratch2); scratch1, scratch2);
@ -4369,12 +4353,11 @@ void MacroAssembler::AllocateHeapNumber(Register result,
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* need_gc, Label* need_gc,
TaggingMode tagging_mode,
MutableMode mode) { MutableMode mode) {
// Allocate an object in the heap for the heap number and tag it as a heap // Allocate an object in the heap for the heap number and tag it as a heap
// object. // object.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, need_gc, 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::RootListIndex map_index = mode == MUTABLE
? Heap::kMutableHeapNumberMapRootIndex ? Heap::kMutableHeapNumberMapRootIndex
@ -4382,11 +4365,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
AssertIsRoot(heap_number_map, map_index); AssertIsRoot(heap_number_map, map_index);
// Store heap number map in the allocated object. // Store heap number map in the allocated object.
if (tagging_mode == TAG_RESULT) { sd(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
sd(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
} else {
sd(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
}
} }
@ -4410,7 +4389,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);

View File

@ -620,7 +620,6 @@ class MacroAssembler: public Assembler {
Register scratch2, Register scratch2,
Register heap_number_map, Register heap_number_map,
Label* gc_required, Label* gc_required,
TaggingMode tagging_mode = TAG_RESULT,
MutableMode mode = IMMUTABLE); MutableMode mode = IMMUTABLE);
void AllocateHeapNumberWithValue(Register result, void AllocateHeapNumberWithValue(Register result,

View File

@ -4449,15 +4449,15 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ movp(Operand(rax, JSObject::kMapOffset), rcx); __ movp(FieldOperand(rax, JSObject::kMapOffset), rcx);
__ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
__ movp(Operand(rax, JSObject::kPropertiesOffset), rbx); __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
__ movp(Operand(rax, JSObject::kElementsOffset), rbx); __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx);
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ leap(rbx, Operand(rax, JSObject::kHeaderSize)); __ leap(rbx, FieldOperand(rax, JSObject::kHeaderSize));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- rax : result (untagged) // -- rax : result (tagged)
// -- rbx : result fields (untagged) // -- rbx : result fields (untagged)
// -- rdi : result end (untagged) // -- rdi : result end (untagged)
// -- rcx : initial map // -- rcx : initial map
@ -4475,10 +4475,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
{ {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ InitializeFieldsWithFiller(rbx, rdi, r11); __ InitializeFieldsWithFiller(rbx, rdi, r11);
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ incp(rax);
__ Ret(); __ Ret();
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
@ -4498,10 +4494,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(r11, Heap::kOnePointerFillerMapRootIndex); __ LoadRoot(r11, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(rdx, rdi, r11); __ 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. // Check if we can finalize the instance size.
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
@ -4532,10 +4524,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(rcx); __ Pop(rcx);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ decp(rax);
__ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset)); __ movzxbl(rbx, FieldOperand(rcx, Map::kInstanceSizeOffset));
__ leap(rdi, Operand(rax, rbx, times_pointer_size, 0)); __ 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); __ jmp(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4601,7 +4593,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in rax. // Setup the rest parameter array in rax.
@ -4642,7 +4634,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ leal(rcx, Operand(rax, times_pointer_size, __ leal(rcx, Operand(rax, times_pointer_size,
JSArray::kSize + FixedArray::kHeaderSize)); 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); __ bind(&done_allocate);
// Compute the arguments.length in rdi. // Compute the arguments.length in rdi.
@ -4790,7 +4782,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ addp(r8, Immediate(JSSloppyArgumentsObject::kSize)); __ addp(r8, Immediate(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // rax = address of new object(s) (tagged)
// r11 = argument count (untagged) // r11 = argument count (untagged)
@ -4994,7 +4986,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ leal(rcx, Operand(rax, times_pointer_size, JSStrictArgumentsObject::kSize + __ leal(rcx, Operand(rax, times_pointer_size, JSStrictArgumentsObject::kSize +
FixedArray::kHeaderSize)); FixedArray::kHeaderSize));
__ Allocate(rcx, rdx, rdi, no_reg, &allocate, TAG_OBJECT); __ Allocate(rcx, rdx, rdi, no_reg, &allocate, NO_ALLOCATION_FLAGS);
__ bind(&done_allocate); __ bind(&done_allocate);
// Compute the arguments.length in rdi. // Compute the arguments.length in rdi.

View File

@ -204,7 +204,7 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
// Allocate new backing store. // Allocate new backing store.
__ bind(&new_backing_store); __ bind(&new_backing_store);
__ leap(rdi, Operand(r9, times_8, FixedArray::kHeaderSize)); __ 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 // Set backing store's map
__ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex); __ LoadRoot(rdi, Heap::kFixedDoubleArrayMapRootIndex);
__ movp(FieldOperand(r14, HeapObject::kMapOffset), rdi); __ movp(FieldOperand(r14, HeapObject::kMapOffset), rdi);
@ -296,7 +296,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
// r8 : source FixedDoubleArray // r8 : source FixedDoubleArray
// r9 : number of elements // r9 : number of elements
__ leap(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); __ 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 // r11: destination FixedArray
__ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex);
__ movp(FieldOperand(r11, HeapObject::kMapOffset), rdi); __ movp(FieldOperand(r11, HeapObject::kMapOffset), rdi);

View File

@ -4913,15 +4913,10 @@ void MacroAssembler::Allocate(int object_size,
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(top_reg, scratch, flags); UpdateAllocationTopHelper(top_reg, scratch, flags);
bool tag_result = (flags & TAG_OBJECT) != 0;
if (top_reg.is(result)) { if (top_reg.is(result)) {
if (tag_result) { subp(result, Immediate(object_size - kHeapObjectTag));
subp(result, Immediate(object_size - kHeapObjectTag)); } else {
} else { // Tag the result.
subp(result, Immediate(object_size));
}
} else if (tag_result) {
// Tag the result if requested.
DCHECK(kHeapObjectTag == 1); DCHECK(kHeapObjectTag == 1);
incp(result); incp(result);
} }
@ -4986,10 +4981,8 @@ void MacroAssembler::Allocate(Register object_size,
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(result_end, scratch, flags); UpdateAllocationTopHelper(result_end, scratch, flags);
// Tag the result if requested. // Tag the result.
if ((flags & TAG_OBJECT) != 0) { addp(result, Immediate(kHeapObjectTag));
addp(result, Immediate(kHeapObjectTag));
}
} }
@ -4998,7 +4991,8 @@ void MacroAssembler::AllocateHeapNumber(Register result,
Label* gc_required, Label* gc_required,
MutableMode mode) { MutableMode mode) {
// Allocate heap number in new space. // 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::RootListIndex map_index = mode == MUTABLE
? Heap::kMutableHeapNumberMapRootIndex ? Heap::kMutableHeapNumberMapRootIndex
@ -5030,14 +5024,8 @@ void MacroAssembler::AllocateTwoByteString(Register result,
} }
// Allocate two byte string in new space. // Allocate two byte string in new space.
Allocate(SeqTwoByteString::kHeaderSize, Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1, result, scratch2,
times_1, scratch3, gc_required, NO_ALLOCATION_FLAGS);
scratch1,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
LoadRoot(kScratchRegister, Heap::kStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kStringMapRootIndex);
@ -5066,14 +5054,8 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
} }
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(SeqOneByteString::kHeaderSize, Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1, result, scratch2,
times_1, scratch3, gc_required, NO_ALLOCATION_FLAGS);
scratch1,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
LoadRoot(kScratchRegister, Heap::kOneByteStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kOneByteStringMapRootIndex);
@ -5091,7 +5073,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
LoadRoot(kScratchRegister, Heap::kConsStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kConsStringMapRootIndex);
@ -5103,12 +5085,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
LoadRoot(kScratchRegister, Heap::kConsOneByteStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kConsOneByteStringMapRootIndex);
@ -5122,7 +5100,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
LoadRoot(kScratchRegister, Heap::kSlicedStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kSlicedStringMapRootIndex);
@ -5136,7 +5114,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
LoadRoot(kScratchRegister, Heap::kSlicedOneByteStringMapRootIndex); LoadRoot(kScratchRegister, Heap::kSlicedOneByteStringMapRootIndex);
@ -5152,7 +5130,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch); LoadGlobalFunctionInitialMap(constructor, scratch);

View File

@ -4386,16 +4386,16 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ bind(&done_allocate); __ bind(&done_allocate);
// Initialize the JSObject fields. // Initialize the JSObject fields.
__ mov(Operand(eax, JSObject::kMapOffset), ecx); __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx);
__ mov(Operand(eax, JSObject::kPropertiesOffset), __ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
masm->isolate()->factory()->empty_fixed_array()); masm->isolate()->factory()->empty_fixed_array());
__ mov(Operand(eax, JSObject::kElementsOffset), __ mov(FieldOperand(eax, JSObject::kElementsOffset),
masm->isolate()->factory()->empty_fixed_array()); masm->isolate()->factory()->empty_fixed_array());
STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize); STATIC_ASSERT(JSObject::kHeaderSize == 3 * kPointerSize);
__ lea(ebx, Operand(eax, JSObject::kHeaderSize)); __ lea(ebx, FieldOperand(eax, JSObject::kHeaderSize));
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : result (untagged) // -- eax : result (tagged)
// -- ebx : result fields (untagged) // -- ebx : result fields (untagged)
// -- edi : result end (untagged) // -- edi : result end (untagged)
// -- ecx : initial map // -- ecx : initial map
@ -4413,10 +4413,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
// Initialize all in-object fields with undefined. // Initialize all in-object fields with undefined.
__ LoadRoot(edx, Heap::kUndefinedValueRootIndex); __ LoadRoot(edx, Heap::kUndefinedValueRootIndex);
__ InitializeFieldsWithFiller(ebx, edi, edx); __ InitializeFieldsWithFiller(ebx, edi, edx);
// Add the object tag to make the JSObject real.
STATIC_ASSERT(kHeapObjectTag == 1);
__ inc(eax);
__ Ret(); __ Ret();
} }
__ bind(&slack_tracking); __ bind(&slack_tracking);
@ -4439,10 +4435,6 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex); __ LoadRoot(edi, Heap::kOnePointerFillerMapRootIndex);
__ InitializeFieldsWithFiller(ebx, edx, edi); __ 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. // Check if we can finalize the instance size.
Label finalize; Label finalize;
STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1); STATIC_ASSERT(Map::kSlackTrackingCounterEnd == 1);
@ -4473,10 +4465,10 @@ void FastNewObjectStub::Generate(MacroAssembler* masm) {
__ CallRuntime(Runtime::kAllocateInNewSpace); __ CallRuntime(Runtime::kAllocateInNewSpace);
__ Pop(ecx); __ Pop(ecx);
} }
STATIC_ASSERT(kHeapObjectTag == 1);
__ dec(eax);
__ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset)); __ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceSizeOffset));
__ lea(edi, Operand(eax, ebx, times_pointer_size, 0)); __ lea(edi, Operand(eax, ebx, times_pointer_size, 0));
STATIC_ASSERT(kHeapObjectTag == 1);
__ dec(edi);
__ jmp(&done_allocate); __ jmp(&done_allocate);
// Fall back to %NewObject. // Fall back to %NewObject.
@ -4539,7 +4531,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// Allocate an empty rest parameter array. // Allocate an empty rest parameter array.
Label allocate, done_allocate; 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); __ bind(&done_allocate);
// Setup the rest parameter array in rax. // Setup the rest parameter array in rax.
@ -4581,7 +4573,7 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
Label allocate, done_allocate; Label allocate, done_allocate;
__ lea(ecx, Operand(eax, times_half_pointer_size, __ lea(ecx, Operand(eax, times_half_pointer_size,
JSArray::kSize + FixedArray::kHeaderSize)); 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); __ bind(&done_allocate);
// Setup the elements array in edx. // Setup the elements array in edx.
@ -4720,7 +4712,7 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ add(ebx, Immediate(JSSloppyArgumentsObject::kSize)); __ add(ebx, Immediate(JSSloppyArgumentsObject::kSize));
// Do the allocation of all three objects in one go. // 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) // eax = address of new object(s) (tagged)
// ecx = argument count (smi-tagged) // ecx = argument count (smi-tagged)
@ -4949,7 +4941,7 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
__ lea(ecx, __ lea(ecx,
Operand(eax, times_half_pointer_size, Operand(eax, times_half_pointer_size,
JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize)); 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); __ bind(&done_allocate);
// Setup the elements array in edx. // Setup the elements array in edx.

View File

@ -275,10 +275,9 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
// Allocate new FixedDoubleArray. // Allocate new FixedDoubleArray.
// edx: receiver // edx: receiver
// edi: length of source FixedArray (smi-tagged) // edi: length of source FixedArray (smi-tagged)
AllocationFlags flags =
static_cast<AllocationFlags>(TAG_OBJECT | DOUBLE_ALIGNMENT);
__ Allocate(FixedDoubleArray::kHeaderSize, times_8, edi, __ 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 // eax: destination FixedDoubleArray
// edi: number of elements // edi: number of elements
@ -391,7 +390,7 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
// Allocate new FixedArray. // Allocate new FixedArray.
// ebx: length of source FixedDoubleArray (smi-tagged) // ebx: length of source FixedDoubleArray (smi-tagged)
__ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); __ 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 // eax: destination FixedArray
// ebx: number of elements // ebx: number of elements

View File

@ -1521,14 +1521,9 @@ void MacroAssembler::Allocate(int object_size,
UpdateAllocationTopHelper(top_reg, scratch, flags); UpdateAllocationTopHelper(top_reg, scratch, flags);
// Tag result if requested. // Tag result if requested.
bool tag_result = (flags & TAG_OBJECT) != 0;
if (top_reg.is(result)) { if (top_reg.is(result)) {
if (tag_result) { sub(result, Immediate(object_size - kHeapObjectTag));
sub(result, Immediate(object_size - kHeapObjectTag)); } else {
} else {
sub(result, Immediate(object_size));
}
} else if (tag_result) {
DCHECK(kHeapObjectTag == 1); DCHECK(kHeapObjectTag == 1);
inc(result); inc(result);
} }
@ -1602,10 +1597,8 @@ void MacroAssembler::Allocate(int header_size,
cmp(result_end, Operand::StaticVariable(allocation_limit)); cmp(result_end, Operand::StaticVariable(allocation_limit));
j(above, gc_required); j(above, gc_required);
if ((flags & TAG_OBJECT) != 0) { DCHECK(kHeapObjectTag == 1);
DCHECK(kHeapObjectTag == 1); inc(result);
inc(result);
}
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(result_end, scratch, flags); UpdateAllocationTopHelper(result_end, scratch, flags);
@ -1666,11 +1659,9 @@ void MacroAssembler::Allocate(Register object_size,
cmp(result_end, Operand::StaticVariable(allocation_limit)); cmp(result_end, Operand::StaticVariable(allocation_limit));
j(above, gc_required); j(above, gc_required);
// Tag result if requested. // Tag result.
if ((flags & TAG_OBJECT) != 0) { DCHECK(kHeapObjectTag == 1);
DCHECK(kHeapObjectTag == 1); inc(result);
inc(result);
}
// Update allocation top. // Update allocation top.
UpdateAllocationTopHelper(result_end, scratch, flags); UpdateAllocationTopHelper(result_end, scratch, flags);
@ -1684,7 +1675,7 @@ void MacroAssembler::AllocateHeapNumber(Register result,
MutableMode mode) { MutableMode mode) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
Handle<Map> map = mode == MUTABLE Handle<Map> map = mode == MUTABLE
? isolate()->factory()->mutable_heap_number_map() ? isolate()->factory()->mutable_heap_number_map()
@ -1710,15 +1701,9 @@ void MacroAssembler::AllocateTwoByteString(Register result,
and_(scratch1, Immediate(~kObjectAlignmentMask)); and_(scratch1, Immediate(~kObjectAlignmentMask));
// Allocate two byte string in new space. // Allocate two byte string in new space.
Allocate(SeqTwoByteString::kHeaderSize, Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1,
times_1, REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
scratch1, NO_ALLOCATION_FLAGS);
REGISTER_VALUE_IS_INT32,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1744,15 +1729,9 @@ void MacroAssembler::AllocateOneByteString(Register result, Register length,
and_(scratch1, Immediate(~kObjectAlignmentMask)); and_(scratch1, Immediate(~kObjectAlignmentMask));
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(SeqOneByteString::kHeaderSize, Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1,
times_1, REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
scratch1, NO_ALLOCATION_FLAGS);
REGISTER_VALUE_IS_INT32,
result,
scratch2,
scratch3,
gc_required,
TAG_OBJECT);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1772,7 +1751,7 @@ void MacroAssembler::AllocateOneByteString(Register result, int length,
// Allocate one-byte string in new space. // Allocate one-byte string in new space.
Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2, Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2,
gc_required, TAG_OBJECT); gc_required, NO_ALLOCATION_FLAGS);
// Set the map, length and hash field. // Set the map, length and hash field.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1790,7 +1769,7 @@ void MacroAssembler::AllocateTwoByteConsString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1802,12 +1781,8 @@ void MacroAssembler::AllocateOneByteConsString(Register result,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
result, NO_ALLOCATION_FLAGS);
scratch1,
scratch2,
gc_required,
TAG_OBJECT);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1821,7 +1796,7 @@ void MacroAssembler::AllocateTwoByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1835,7 +1810,7 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result,
Label* gc_required) { Label* gc_required) {
// Allocate heap number in new space. // Allocate heap number in new space.
Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
TAG_OBJECT); NO_ALLOCATION_FLAGS);
// Set the map. The other fields are left uninitialized. // Set the map. The other fields are left uninitialized.
mov(FieldOperand(result, HeapObject::kMapOffset), mov(FieldOperand(result, HeapObject::kMapOffset),
@ -1851,7 +1826,8 @@ void MacroAssembler::AllocateJSValue(Register result, Register constructor,
DCHECK(!result.is(value)); DCHECK(!result.is(value));
// Allocate JSValue in new space. // 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. // Initialize the JSValue.
LoadGlobalFunctionInitialMap(constructor, scratch); LoadGlobalFunctionInitialMap(constructor, scratch);