Make BitField3 a raw uint32 field, and move to the start of the map.
BUG= R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/272163002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
bd93673f40
commit
ec195cd929
@ -3047,7 +3047,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
|
|||||||
__ add(r4, r4, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
|
__ add(r4, r4, Operand(DescriptorArray::kFirstOffset - kHeapObjectTag));
|
||||||
// Calculate the end of the descriptor array.
|
// Calculate the end of the descriptor array.
|
||||||
__ mov(r2, r4);
|
__ mov(r2, r4);
|
||||||
__ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3));
|
__ add(r2, r2, Operand(r3, LSL, kPointerSizeLog2));
|
||||||
|
|
||||||
// Loop through all the keys in the descriptor array. If one of these is the
|
// Loop through all the keys in the descriptor array. If one of these is the
|
||||||
// string "valueOf" the result is false.
|
// string "valueOf" the result is false.
|
||||||
|
@ -3596,7 +3596,7 @@ void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
|||||||
if (map->CanBeDeprecated()) {
|
if (map->CanBeDeprecated()) {
|
||||||
mov(scratch, Operand(map));
|
mov(scratch, Operand(map));
|
||||||
ldr(scratch, FieldMemOperand(scratch, Map::kBitField3Offset));
|
ldr(scratch, FieldMemOperand(scratch, Map::kBitField3Offset));
|
||||||
tst(scratch, Operand(Smi::FromInt(Map::Deprecated::kMask)));
|
tst(scratch, Operand(Map::Deprecated::kMask));
|
||||||
b(ne, if_deprecated);
|
b(ne, if_deprecated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3854,7 +3854,8 @@ void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
|
|||||||
void MacroAssembler::EnumLength(Register dst, Register map) {
|
void MacroAssembler::EnumLength(Register dst, Register map) {
|
||||||
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
||||||
ldr(dst, FieldMemOperand(map, Map::kBitField3Offset));
|
ldr(dst, FieldMemOperand(map, Map::kBitField3Offset));
|
||||||
and_(dst, dst, Operand(Smi::FromInt(Map::EnumLengthBits::kMask)));
|
and_(dst, dst, Operand(Map::EnumLengthBits::kMask));
|
||||||
|
SmiTag(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1357,7 +1357,7 @@ class MacroAssembler: public Assembler {
|
|||||||
template<typename Field>
|
template<typename Field>
|
||||||
void DecodeField(Register reg) {
|
void DecodeField(Register reg) {
|
||||||
static const int shift = Field::kShift;
|
static const int shift = Field::kShift;
|
||||||
static const int mask = (Field::kMask >> shift) << kSmiTagSize;
|
static const int mask = Field::kMask >> shift;
|
||||||
mov(reg, Operand(reg, LSR, shift));
|
mov(reg, Operand(reg, LSR, shift));
|
||||||
and_(reg, reg, Operand(mask));
|
and_(reg, reg, Operand(mask));
|
||||||
}
|
}
|
||||||
|
@ -1325,15 +1325,14 @@ void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
|
|||||||
|
|
||||||
void MacroAssembler::EnumLengthUntagged(Register dst, Register map) {
|
void MacroAssembler::EnumLengthUntagged(Register dst, Register map) {
|
||||||
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
||||||
Ldrsw(dst, UntagSmiFieldMemOperand(map, Map::kBitField3Offset));
|
Ldrsw(dst, FieldMemOperand(map, Map::kBitField3Offset));
|
||||||
And(dst, dst, Map::EnumLengthBits::kMask);
|
And(dst, dst, Map::EnumLengthBits::kMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::EnumLengthSmi(Register dst, Register map) {
|
void MacroAssembler::EnumLengthSmi(Register dst, Register map) {
|
||||||
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
EnumLengthUntagged(dst, map);
|
||||||
Ldr(dst, FieldMemOperand(map, Map::kBitField3Offset));
|
SmiTag(dst, dst);
|
||||||
And(dst, dst, Smi::FromInt(Map::EnumLengthBits::kMask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4515,7 +4514,7 @@ void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
|||||||
Label* if_deprecated) {
|
Label* if_deprecated) {
|
||||||
if (map->CanBeDeprecated()) {
|
if (map->CanBeDeprecated()) {
|
||||||
Mov(scratch, Operand(map));
|
Mov(scratch, Operand(map));
|
||||||
Ldrsw(scratch, UntagSmiFieldMemOperand(scratch, Map::kBitField3Offset));
|
Ldrsw(scratch, FieldMemOperand(scratch, Map::kBitField3Offset));
|
||||||
TestAndBranchIfAnySet(scratch, Map::Deprecated::kMask, if_deprecated);
|
TestAndBranchIfAnySet(scratch, Map::Deprecated::kMask, if_deprecated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,7 +843,7 @@ class MacroAssembler : public Assembler {
|
|||||||
|
|
||||||
template<typename Field>
|
template<typename Field>
|
||||||
void DecodeField(Register reg) {
|
void DecodeField(Register reg) {
|
||||||
static const uint64_t shift = Field::kShift + kSmiShift;
|
static const uint64_t shift = Field::kShift;
|
||||||
static const uint64_t setbits = CountSetBits(Field::kMask, 32);
|
static const uint64_t setbits = CountSetBits(Field::kMask, 32);
|
||||||
Ubfx(reg, reg, shift, setbits);
|
Ubfx(reg, reg, shift, setbits);
|
||||||
}
|
}
|
||||||
|
@ -2986,7 +2986,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
|
|||||||
STATIC_ASSERT(kSmiTagSize == 1);
|
STATIC_ASSERT(kSmiTagSize == 1);
|
||||||
STATIC_ASSERT(kPointerSize == 4);
|
STATIC_ASSERT(kPointerSize == 4);
|
||||||
__ imul(ecx, ecx, DescriptorArray::kDescriptorSize);
|
__ imul(ecx, ecx, DescriptorArray::kDescriptorSize);
|
||||||
__ lea(ecx, Operand(ebx, ecx, times_2, DescriptorArray::kFirstOffset));
|
__ lea(ecx, Operand(ebx, ecx, times_4, DescriptorArray::kFirstOffset));
|
||||||
// Calculate location of the first key name.
|
// Calculate location of the first key name.
|
||||||
__ add(ebx, Immediate(DescriptorArray::kFirstOffset));
|
__ add(ebx, Immediate(DescriptorArray::kFirstOffset));
|
||||||
// Loop through all the keys in the descriptor array. If one of these is the
|
// Loop through all the keys in the descriptor array. If one of these is the
|
||||||
|
@ -3182,7 +3182,7 @@ void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
|||||||
if (map->CanBeDeprecated()) {
|
if (map->CanBeDeprecated()) {
|
||||||
mov(scratch, map);
|
mov(scratch, map);
|
||||||
mov(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
mov(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
||||||
and_(scratch, Immediate(Smi::FromInt(Map::Deprecated::kMask)));
|
and_(scratch, Immediate(Map::Deprecated::kMask));
|
||||||
j(not_zero, if_deprecated);
|
j(not_zero, if_deprecated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3360,7 +3360,8 @@ void MacroAssembler::EnsureNotWhite(
|
|||||||
void MacroAssembler::EnumLength(Register dst, Register map) {
|
void MacroAssembler::EnumLength(Register dst, Register map) {
|
||||||
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
||||||
mov(dst, FieldOperand(map, Map::kBitField3Offset));
|
mov(dst, FieldOperand(map, Map::kBitField3Offset));
|
||||||
and_(dst, Immediate(Smi::FromInt(Map::EnumLengthBits::kMask)));
|
and_(dst, Immediate(Map::EnumLengthBits::kMask));
|
||||||
|
SmiTag(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ class MacroAssembler: public Assembler {
|
|||||||
template<typename Field>
|
template<typename Field>
|
||||||
void DecodeField(Register reg) {
|
void DecodeField(Register reg) {
|
||||||
static const int shift = Field::kShift;
|
static const int shift = Field::kShift;
|
||||||
static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize;
|
static const int mask = Field::kMask >> Field::kShift;
|
||||||
sar(reg, shift);
|
sar(reg, shift);
|
||||||
and_(reg, Immediate(mask));
|
and_(reg, Immediate(mask));
|
||||||
}
|
}
|
||||||
|
@ -4753,16 +4753,15 @@ ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset)
|
|||||||
|
|
||||||
|
|
||||||
void Map::set_bit_field3(uint32_t bits) {
|
void Map::set_bit_field3(uint32_t bits) {
|
||||||
// Ensure the upper 2 bits have the same value by sign extending it. This is
|
if (kInt32Size != kPointerSize) {
|
||||||
// necessary to be able to use the 31st bit.
|
WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0);
|
||||||
int value = bits << 1;
|
}
|
||||||
WRITE_FIELD(this, kBitField3Offset, Smi::FromInt(value >> 1));
|
WRITE_UINT32_FIELD(this, kBitField3Offset, bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t Map::bit_field3() {
|
uint32_t Map::bit_field3() {
|
||||||
Object* value = READ_FIELD(this, kBitField3Offset);
|
return READ_UINT32_FIELD(this, kBitField3Offset);
|
||||||
return Smi::cast(value)->value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6481,7 +6481,8 @@ class Map: public HeapObject {
|
|||||||
// Layout description.
|
// Layout description.
|
||||||
static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
|
static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
|
||||||
static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
|
static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
|
||||||
static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
|
static const int kBitField3Offset = kInstanceAttributesOffset + kIntSize;
|
||||||
|
static const int kPrototypeOffset = kBitField3Offset + kPointerSize;
|
||||||
static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
|
static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
|
||||||
// Storage for the transition array is overloaded to directly contain a back
|
// Storage for the transition array is overloaded to directly contain a back
|
||||||
// pointer if unused. When the map has transitions, the back pointer is
|
// pointer if unused. When the map has transitions, the back pointer is
|
||||||
@ -6493,13 +6494,12 @@ class Map: public HeapObject {
|
|||||||
kTransitionsOrBackPointerOffset + kPointerSize;
|
kTransitionsOrBackPointerOffset + kPointerSize;
|
||||||
static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
|
static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize;
|
||||||
static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
|
static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize;
|
||||||
static const int kBitField3Offset = kDependentCodeOffset + kPointerSize;
|
static const int kSize = kDependentCodeOffset + kPointerSize;
|
||||||
static const int kSize = kBitField3Offset + kPointerSize;
|
|
||||||
|
|
||||||
// Layout of pointer fields. Heap iteration code relies on them
|
// Layout of pointer fields. Heap iteration code relies on them
|
||||||
// being continuously allocated.
|
// being continuously allocated.
|
||||||
static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
|
static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset;
|
||||||
static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize;
|
static const int kPointerFieldsEndOffset = kSize;
|
||||||
|
|
||||||
// Byte offsets within kInstanceSizesOffset.
|
// Byte offsets within kInstanceSizesOffset.
|
||||||
static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
|
static const int kInstanceSizeOffset = kInstanceSizesOffset + 0;
|
||||||
|
@ -2976,11 +2976,8 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
|
|||||||
// rbx: descriptor array.
|
// rbx: descriptor array.
|
||||||
// rcx: valid entries in the descriptor array.
|
// rcx: valid entries in the descriptor array.
|
||||||
// Calculate the end of the descriptor array.
|
// Calculate the end of the descriptor array.
|
||||||
__ imulp(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize));
|
__ imull(rcx, rcx, Immediate(DescriptorArray::kDescriptorSize));
|
||||||
SmiIndex index = masm_->SmiToIndex(rdx, rcx, kPointerSizeLog2);
|
__ leal(rcx, Operand(r8, rcx, times_4, DescriptorArray::kFirstOffset));
|
||||||
__ leap(rcx,
|
|
||||||
Operand(
|
|
||||||
r8, index.reg, index.scale, DescriptorArray::kFirstOffset));
|
|
||||||
// Calculate location of the first key name.
|
// Calculate location of the first key name.
|
||||||
__ addp(r8, Immediate(DescriptorArray::kFirstOffset));
|
__ addp(r8, Immediate(DescriptorArray::kFirstOffset));
|
||||||
// Loop through all the keys in the descriptor array. If one of these is the
|
// Loop through all the keys in the descriptor array. If one of these is the
|
||||||
|
@ -3484,16 +3484,16 @@ void MacroAssembler::LoadInstanceDescriptors(Register map,
|
|||||||
|
|
||||||
|
|
||||||
void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
|
void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
|
||||||
movp(dst, FieldOperand(map, Map::kBitField3Offset));
|
movl(dst, FieldOperand(map, Map::kBitField3Offset));
|
||||||
DecodeField<Map::NumberOfOwnDescriptorsBits>(dst);
|
DecodeField<Map::NumberOfOwnDescriptorsBits>(dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::EnumLength(Register dst, Register map) {
|
void MacroAssembler::EnumLength(Register dst, Register map) {
|
||||||
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
STATIC_ASSERT(Map::EnumLengthBits::kShift == 0);
|
||||||
movp(dst, FieldOperand(map, Map::kBitField3Offset));
|
movl(dst, FieldOperand(map, Map::kBitField3Offset));
|
||||||
Move(kScratchRegister, Smi::FromInt(Map::EnumLengthBits::kMask));
|
andl(dst, Immediate(Map::EnumLengthBits::kMask));
|
||||||
andp(dst, kScratchRegister);
|
Integer32ToSmi(dst, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4959,9 +4959,8 @@ void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
|||||||
Label* if_deprecated) {
|
Label* if_deprecated) {
|
||||||
if (map->CanBeDeprecated()) {
|
if (map->CanBeDeprecated()) {
|
||||||
Move(scratch, map);
|
Move(scratch, map);
|
||||||
movp(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
movl(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
||||||
SmiToInteger32(scratch, scratch);
|
andl(scratch, Immediate(Map::Deprecated::kMask));
|
||||||
andp(scratch, Immediate(Map::Deprecated::kMask));
|
|
||||||
j(not_zero, if_deprecated);
|
j(not_zero, if_deprecated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1011,11 +1011,10 @@ class MacroAssembler: public Assembler {
|
|||||||
|
|
||||||
template<typename Field>
|
template<typename Field>
|
||||||
void DecodeField(Register reg) {
|
void DecodeField(Register reg) {
|
||||||
static const int shift = Field::kShift + kSmiShift;
|
static const int shift = Field::kShift;
|
||||||
static const int mask = Field::kMask >> Field::kShift;
|
static const int mask = Field::kMask >> Field::kShift;
|
||||||
shrp(reg, Immediate(shift));
|
shrl(reg, Immediate(shift));
|
||||||
andp(reg, Immediate(mask));
|
andl(reg, Immediate(mask));
|
||||||
shlp(reg, Immediate(kSmiShift));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abort execution if argument is not a number, enabled via --debug-code.
|
// Abort execution if argument is not a number, enabled via --debug-code.
|
||||||
|
Loading…
Reference in New Issue
Block a user