Bug 1667753 part 2 - Rename RawWord field type to RawInt32. r=anba

emitLoadStubField and emitLoadStubFieldConstant use move32/load32 for this type
so RawInt32 is more appropriate than RawWord.

Depends on D92601

Differential Revision: https://phabricator.services.mozilla.com/D92602
This commit is contained in:
Jan de Mooij 2020-10-06 13:00:22 +00:00
parent 1e3ea0c6ad
commit 1879259682
8 changed files with 49 additions and 49 deletions

View file

@ -189,8 +189,8 @@ JS::Symbol* CacheIRCloner::getSymbolField(uint32_t stubOffset) {
BaseScript* CacheIRCloner::getBaseScriptField(uint32_t stubOffset) { BaseScript* CacheIRCloner::getBaseScriptField(uint32_t stubOffset) {
return reinterpret_cast<BaseScript*>(readStubWord(stubOffset)); return reinterpret_cast<BaseScript*>(readStubWord(stubOffset));
} }
uintptr_t CacheIRCloner::getRawWordField(uint32_t stubOffset) { uint32_t CacheIRCloner::getRawInt32Field(uint32_t stubOffset) {
return reinterpret_cast<uintptr_t>(readStubWord(stubOffset)); return uint32_t(reinterpret_cast<uintptr_t>(readStubWord(stubOffset)));
} }
const void* CacheIRCloner::getRawPointerField(uint32_t stubOffset) { const void* CacheIRCloner::getRawPointerField(uint32_t stubOffset) {
return reinterpret_cast<const void*>(readStubWord(stubOffset)); return reinterpret_cast<const void*>(readStubWord(stubOffset));

View file

@ -228,7 +228,7 @@ class StubField {
public: public:
enum class Type : uint8_t { enum class Type : uint8_t {
// These fields take up a single word. // These fields take up a single word.
RawWord, RawInt32,
RawPointer, RawPointer,
Shape, Shape,
ObjectGroup, ObjectGroup,
@ -622,8 +622,8 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
MOZ_ASSERT(script); MOZ_ASSERT(script);
addStubField(uintptr_t(script), StubField::Type::BaseScript); addStubField(uintptr_t(script), StubField::Type::BaseScript);
} }
void writeRawWordField(uintptr_t word) { void writeRawInt32Field(uint32_t val) {
addStubField(word, StubField::Type::RawWord); addStubField(val, StubField::Type::RawInt32);
} }
void writeRawPointerField(const void* ptr) { void writeRawPointerField(const void* ptr) {
addStubField(uintptr_t(ptr), StubField::Type::RawPointer); addStubField(uintptr_t(ptr), StubField::Type::RawPointer);
@ -1208,7 +1208,7 @@ class MOZ_RAII CacheIRCloner {
PropertyName* getPropertyNameField(uint32_t stubOffset); PropertyName* getPropertyNameField(uint32_t stubOffset);
JS::Symbol* getSymbolField(uint32_t stubOffset); JS::Symbol* getSymbolField(uint32_t stubOffset);
BaseScript* getBaseScriptField(uint32_t stubOffset); BaseScript* getBaseScriptField(uint32_t stubOffset);
uintptr_t getRawWordField(uint32_t stubOffset); uint32_t getRawInt32Field(uint32_t stubOffset);
const void* getRawPointerField(uint32_t stubOffset); const void* getRawPointerField(uint32_t stubOffset);
jsid getIdField(uint32_t stubOffset); jsid getIdField(uint32_t stubOffset);
const Value getValueField(uint32_t stubOffset); const Value getValueField(uint32_t stubOffset);

View file

@ -1107,7 +1107,7 @@ void CacheIRWriter::copyStubData(uint8_t* dest) const {
for (const StubField& field : stubFields_) { for (const StubField& field : stubFields_) {
switch (field.type()) { switch (field.type()) {
case StubField::Type::RawWord: case StubField::Type::RawInt32:
case StubField::Type::RawPointer: case StubField::Type::RawPointer:
*destWords = field.asWord(); *destWords = field.asWord();
break; break;
@ -1155,7 +1155,7 @@ void jit::TraceCacheIRStub(JSTracer* trc, T* stub,
while (true) { while (true) {
StubField::Type fieldType = stubInfo->fieldType(field); StubField::Type fieldType = stubInfo->fieldType(field);
switch (fieldType) { switch (fieldType) {
case StubField::Type::RawWord: case StubField::Type::RawInt32:
case StubField::Type::RawPointer: case StubField::Type::RawPointer:
case StubField::Type::RawInt64: case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration: case StubField::Type::DOMExpandoGeneration:
@ -2008,7 +2008,7 @@ bool CacheIRCompiler::emitGuardDynamicSlotIsSpecificObject(
} }
// Guard on the expected object. // Guard on the expected object.
StubFieldOffset slot(slotOffset, StubField::Type::RawWord); StubFieldOffset slot(slotOffset, StubField::Type::RawInt32);
masm.loadPtr(Address(obj, NativeObject::offsetOfSlots()), scratch1); masm.loadPtr(Address(obj, NativeObject::offsetOfSlots()), scratch1);
emitLoadStubField(slot, scratch2); emitLoadStubField(slot, scratch2);
BaseObjectSlotIndex expectedSlot(scratch1, scratch2); BaseObjectSlotIndex expectedSlot(scratch1, scratch2);
@ -5393,7 +5393,7 @@ bool CacheIRCompiler::emitStoreTypedObjectScalarProperty(
Scalar::Type type, uint32_t rhsId) { Scalar::Type type, uint32_t rhsId) {
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__); JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
Register obj = allocator.useRegister(masm, objId); Register obj = allocator.useRegister(masm, objId);
StubFieldOffset offset(offsetOffset, StubField::Type::RawWord); StubFieldOffset offset(offsetOffset, StubField::Type::RawInt32);
AutoAvailableFloatRegister floatScratch0(*this, FloatReg0); AutoAvailableFloatRegister floatScratch0(*this, FloatReg0);
@ -5475,7 +5475,7 @@ bool CacheIRCompiler::emitLoadTypedObjectResult(ObjOperandId objId,
AutoScratchRegister scratch1(allocator, masm); AutoScratchRegister scratch1(allocator, masm);
AutoScratchRegister scratch2(allocator, masm); AutoScratchRegister scratch2(allocator, masm);
StubFieldOffset offset(offsetOffset, StubField::Type::RawWord); StubFieldOffset offset(offsetOffset, StubField::Type::RawInt32);
// Allocate BigInt if needed. The code after this should be infallible. // Allocate BigInt if needed. The code after this should be infallible.
Maybe<Register> bigInt; Maybe<Register> bigInt;
@ -5574,7 +5574,7 @@ bool CacheIRCompiler::emitStoreFixedSlotUndefinedResult(ObjOperandId objId,
Register obj = allocator.useRegister(masm, objId); Register obj = allocator.useRegister(masm, objId);
ValueOperand val = allocator.useValueRegister(masm, rhsId); ValueOperand val = allocator.useValueRegister(masm, rhsId);
StubFieldOffset offset(offsetOffset, StubField::Type::RawWord); StubFieldOffset offset(offsetOffset, StubField::Type::RawInt32);
emitLoadStubField(offset, scratch); emitLoadStubField(offset, scratch);
BaseIndex slot(obj, scratch, TimesOne); BaseIndex slot(obj, scratch, TimesOne);
@ -6968,7 +6968,7 @@ void CacheIRCompiler::emitLoadStubFieldConstant(StubFieldOffset val,
case StubField::Type::RawPointer: case StubField::Type::RawPointer:
masm.movePtr(ImmPtr(pointerStubField(val.getOffset())), dest); masm.movePtr(ImmPtr(pointerStubField(val.getOffset())), dest);
break; break;
case StubField::Type::RawWord: case StubField::Type::RawInt32:
masm.move32(Imm32(int32StubField(val.getOffset())), dest); masm.move32(Imm32(int32StubField(val.getOffset())), dest);
break; break;
default: default:
@ -7001,7 +7001,7 @@ void CacheIRCompiler::emitLoadStubField(StubFieldOffset val, Register dest) {
case StubField::Type::Id: case StubField::Type::Id:
masm.loadPtr(load, dest); masm.loadPtr(load, dest);
break; break;
case StubField::Type::RawWord: case StubField::Type::RawInt32:
masm.load32(load, dest); masm.load32(load, dest);
break; break;
default: default:
@ -7013,7 +7013,7 @@ void CacheIRCompiler::emitLoadStubField(StubFieldOffset val, Register dest) {
Address CacheIRCompiler::emitAddressFromStubField(StubFieldOffset val, Address CacheIRCompiler::emitAddressFromStubField(StubFieldOffset val,
Register base) { Register base) {
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__); JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
MOZ_ASSERT(val.getStubFieldType() == StubField::Type::RawWord); MOZ_ASSERT(val.getStubFieldType() == StubField::Type::RawInt32);
if (stubFieldPolicy_ == StubFieldPolicy::Constant) { if (stubFieldPolicy_ == StubFieldPolicy::Constant) {
int32_t offset = int32StubField(val.getOffset()); int32_t offset = int32StubField(val.getOffset());
@ -7245,7 +7245,7 @@ bool CacheIRCompiler::emitLoadInt32Constant(uint32_t valOffset,
Int32OperandId resultId) { Int32OperandId resultId) {
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__); JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
Register reg = allocator.defineRegister(masm, resultId); Register reg = allocator.defineRegister(masm, resultId);
StubFieldOffset val(valOffset, StubField::Type::RawWord); StubFieldOffset val(valOffset, StubField::Type::RawInt32);
emitLoadStubField(val, reg); emitLoadStubField(val, reg);
return true; return true;
} }

View file

@ -852,11 +852,11 @@ class MOZ_RAII CacheIRCompiler {
} }
int32_t int32StubField(uint32_t offset) { int32_t int32StubField(uint32_t offset) {
MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant); MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant);
return readStubWord(offset, StubField::Type::RawWord); return readStubWord(offset, StubField::Type::RawInt32);
} }
uint32_t uint32StubField(uint32_t offset) { uint32_t uint32StubField(uint32_t offset) {
MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant); MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant);
return readStubWord(offset, StubField::Type::RawWord); return readStubWord(offset, StubField::Type::RawInt32);
} }
Shape* shapeStubField(uint32_t offset) { Shape* shapeStubField(uint32_t offset) {
MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant); MOZ_ASSERT(stubFieldPolicy_ == StubFieldPolicy::Constant);

View file

@ -437,7 +437,7 @@
args: args:
fun: ObjId fun: ObjId
expected: ObjectField expected: ObjectField
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: GuardFunctionScript - name: GuardFunctionScript
shared: false shared: false
@ -447,7 +447,7 @@
args: args:
obj: ObjId obj: ObjId
expected: BaseScriptField expected: BaseScriptField
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: GuardSpecificAtom - name: GuardSpecificAtom
shared: false shared: false
@ -605,7 +605,7 @@
args: args:
obj: ObjId obj: ObjId
expected: ObjId expected: ObjId
slot: RawWordField slot: RawInt32Field
- name: GuardNoAllocationMetadataBuilder - name: GuardNoAllocationMetadataBuilder
shared: true shared: true
@ -825,7 +825,7 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
- name: StoreDynamicSlot - name: StoreDynamicSlot
@ -834,7 +834,7 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
- name: AddAndStoreFixedSlot - name: AddAndStoreFixedSlot
@ -843,7 +843,7 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
changeGroup: BoolImm changeGroup: BoolImm
newGroup: GroupField newGroup: GroupField
@ -855,7 +855,7 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
changeGroup: BoolImm changeGroup: BoolImm
newGroup: GroupField newGroup: GroupField
@ -867,12 +867,12 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
changeGroup: BoolImm changeGroup: BoolImm
newGroup: GroupField newGroup: GroupField
newShape: ShapeField newShape: ShapeField
numNewSlots: RawWordField numNewSlots: RawInt32Field
- name: StoreTypedObjectReferenceProperty - name: StoreTypedObjectReferenceProperty
shared: false shared: false
@ -880,7 +880,7 @@
cost_estimate: 6 cost_estimate: 6
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
layout: TypedThingLayoutImm layout: TypedThingLayoutImm
type: ReferenceTypeImm type: ReferenceTypeImm
rhs: ValId rhs: ValId
@ -891,7 +891,7 @@
cost_estimate: 2 cost_estimate: 2
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
layout: TypedThingLayoutImm layout: TypedThingLayoutImm
type: ScalarTypeImm type: ScalarTypeImm
rhs: RawId rhs: RawId
@ -967,7 +967,7 @@
transpile: true transpile: true
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
rhs: ValId rhs: ValId
- name: IsObjectResult - name: IsObjectResult
@ -1461,7 +1461,7 @@
setter: ObjectField setter: ObjectField
rhs: ValId rhs: ValId
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallScriptedSetter - name: CallScriptedSetter
shared: false shared: false
@ -1473,7 +1473,7 @@
setter: ObjectField setter: ObjectField
rhs: ValId rhs: ValId
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallInlinedSetter - name: CallInlinedSetter
shared: false shared: false
@ -1486,7 +1486,7 @@
rhs: ValId rhs: ValId
icScript: RawPointerField icScript: RawPointerField
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallDOMSetter - name: CallDOMSetter
shared: false shared: false
@ -1625,7 +1625,7 @@
cost_estimate: 1 cost_estimate: 1
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
- name: LoadFixedSlotTypedResult - name: LoadFixedSlotTypedResult
shared: false shared: false
@ -1633,7 +1633,7 @@
cost_estimate: 1 cost_estimate: 1
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
type: ValueTypeImm type: ValueTypeImm
- name: LoadDynamicSlotResult - name: LoadDynamicSlotResult
@ -1642,7 +1642,7 @@
cost_estimate: 1 cost_estimate: 1
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
- name: LoadTypedObjectResult - name: LoadTypedObjectResult
shared: true shared: true
@ -1652,7 +1652,7 @@
obj: ObjId obj: ObjId
layout: TypedThingLayoutImm layout: TypedThingLayoutImm
typeDescr: ByteImm typeDescr: ByteImm
offset: RawWordField offset: RawInt32Field
- name: LoadDenseElementResult - name: LoadDenseElementResult
shared: true shared: true
@ -1860,7 +1860,7 @@
cost_estimate: 1 cost_estimate: 1
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
- name: LoadEnvironmentDynamicSlotResult - name: LoadEnvironmentDynamicSlotResult
shared: false shared: false
@ -1868,7 +1868,7 @@
cost_estimate: 1 cost_estimate: 1
args: args:
obj: ObjId obj: ObjId
offset: RawWordField offset: RawInt32Field
- name: LoadObjectResult - name: LoadObjectResult
shared: true shared: true
@ -1921,7 +1921,7 @@
receiver: ValId receiver: ValId
getter: ObjectField getter: ObjectField
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallInlinedGetterResult - name: CallInlinedGetterResult
shared: false shared: false
@ -1933,7 +1933,7 @@
getter: ObjectField getter: ObjectField
icScript: RawPointerField icScript: RawPointerField
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallNativeGetterResult - name: CallNativeGetterResult
shared: false shared: false
@ -1944,7 +1944,7 @@
receiver: ValId receiver: ValId
getter: ObjectField getter: ObjectField
sameRealm: BoolImm sameRealm: BoolImm
nargsAndFlags: RawWordField nargsAndFlags: RawInt32Field
- name: CallDOMGetterResult - name: CallDOMGetterResult
shared: false shared: false
@ -2022,7 +2022,7 @@
transpile: true transpile: true
cost_estimate: 1 cost_estimate: 1
args: args:
val: RawWordField val: RawInt32Field
result: Int32Id result: Int32Id
- name: LoadBooleanConstant - name: LoadBooleanConstant

View file

@ -79,7 +79,7 @@ arg_writer_info = {
'PropertyNameField': ('PropertyName*', 'writeStringField'), 'PropertyNameField': ('PropertyName*', 'writeStringField'),
'SymbolField': ('JS::Symbol*', 'writeSymbolField'), 'SymbolField': ('JS::Symbol*', 'writeSymbolField'),
'BaseScriptField': ('BaseScript*', 'writeBaseScriptField'), 'BaseScriptField': ('BaseScript*', 'writeBaseScriptField'),
'RawWordField': ('uintptr_t', 'writeRawWordField'), 'RawInt32Field': ('uint32_t', 'writeRawInt32Field'),
'RawPointerField': ('const void*', 'writeRawPointerField'), 'RawPointerField': ('const void*', 'writeRawPointerField'),
'IdField': ('jsid', 'writeIdField'), 'IdField': ('jsid', 'writeIdField'),
'ValueField': ('const Value&', 'writeValueField'), 'ValueField': ('const Value&', 'writeValueField'),
@ -177,7 +177,7 @@ arg_reader_info = {
'PropertyNameField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'PropertyNameField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'SymbolField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'SymbolField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'BaseScriptField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'BaseScriptField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'RawWordField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'RawInt32Field': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'RawPointerField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'RawPointerField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'IdField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'IdField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
'ValueField': ('uint32_t', 'Offset', 'reader.stubOffset()'), 'ValueField': ('uint32_t', 'Offset', 'reader.stubOffset()'),
@ -261,7 +261,7 @@ arg_spewer_method = {
'PropertyNameField': 'spewField', 'PropertyNameField': 'spewField',
'SymbolField': 'spewField', 'SymbolField': 'spewField',
'BaseScriptField': 'spewField', 'BaseScriptField': 'spewField',
'RawWordField': 'spewField', 'RawInt32Field': 'spewField',
'RawPointerField': 'spewField', 'RawPointerField': 'spewField',
'IdField': 'spewField', 'IdField': 'spewField',
'ValueField': 'spewField', 'ValueField': 'spewField',
@ -395,7 +395,7 @@ arg_length = {
'PropertyNameField': 1, 'PropertyNameField': 1,
'SymbolField': 1, 'SymbolField': 1,
'BaseScriptField': 1, 'BaseScriptField': 1,
'RawWordField': 1, 'RawInt32Field': 1,
'RawPointerField': 1, 'RawPointerField': 1,
'DOMExpandoGenerationField': 1, 'DOMExpandoGenerationField': 1,
'IdField': 1, 'IdField': 1,

View file

@ -1043,7 +1043,7 @@ bool WarpScriptOracle::replaceNurseryPointers(ICStub* stub,
while (true) { while (true) {
StubField::Type fieldType = stubInfo->fieldType(field); StubField::Type fieldType = stubInfo->fieldType(field);
switch (fieldType) { switch (fieldType) {
case StubField::Type::RawWord: case StubField::Type::RawInt32:
case StubField::Type::RawPointer: case StubField::Type::RawPointer:
case StubField::Type::RawInt64: case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration: case StubField::Type::DOMExpandoGeneration:

View file

@ -323,7 +323,7 @@ void WarpCacheIR::traceData(JSTracer* trc) {
while (true) { while (true) {
StubField::Type fieldType = stubInfo_->fieldType(field); StubField::Type fieldType = stubInfo_->fieldType(field);
switch (fieldType) { switch (fieldType) {
case StubField::Type::RawWord: case StubField::Type::RawInt32:
case StubField::Type::RawPointer: case StubField::Type::RawPointer:
case StubField::Type::RawInt64: case StubField::Type::RawInt64:
case StubField::Type::DOMExpandoGeneration: case StubField::Type::DOMExpandoGeneration: