зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1671228: Part 3: Transpile GuardMultipleShapes r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D160930
This commit is contained in:
Родитель
8bbc2d9f7a
Коммит
3ef41c5336
|
@ -241,7 +241,7 @@
|
||||||
|
|
||||||
- name: GuardMultipleShapes
|
- name: GuardMultipleShapes
|
||||||
shared: true
|
shared: true
|
||||||
transpile: false
|
transpile: true
|
||||||
cost_estimate: 2
|
cost_estimate: 2
|
||||||
custom_writer: true
|
custom_writer: true
|
||||||
args:
|
args:
|
||||||
|
|
|
@ -4077,6 +4077,21 @@ void CodeGenerator::visitGuardShape(LGuardShape* guard) {
|
||||||
bailoutFrom(&bail, guard->snapshot());
|
bailoutFrom(&bail, guard->snapshot());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeGenerator::visitGuardMultipleShapes(LGuardMultipleShapes* guard) {
|
||||||
|
Register obj = ToRegister(guard->object());
|
||||||
|
Register shapeList = ToRegister(guard->shapeList());
|
||||||
|
Register temp = ToRegister(guard->temp0());
|
||||||
|
Register temp2 = ToRegister(guard->temp1());
|
||||||
|
Register temp3 = ToRegister(guard->temp2());
|
||||||
|
Register spectre = ToTempRegisterOrInvalid(guard->temp3());
|
||||||
|
|
||||||
|
Label bail;
|
||||||
|
masm.loadPtr(Address(shapeList, NativeObject::offsetOfElements()), temp);
|
||||||
|
masm.branchTestObjShapeList(Assembler::NotEqual, obj, temp, temp2, temp3,
|
||||||
|
spectre, &bail);
|
||||||
|
bailoutFrom(&bail, guard->snapshot());
|
||||||
|
}
|
||||||
|
|
||||||
void CodeGenerator::visitGuardProto(LGuardProto* guard) {
|
void CodeGenerator::visitGuardProto(LGuardProto* guard) {
|
||||||
Register obj = ToRegister(guard->object());
|
Register obj = ToRegister(guard->object());
|
||||||
Register expected = ToRegister(guard->expected());
|
Register expected = ToRegister(guard->expected());
|
||||||
|
|
|
@ -2421,6 +2421,14 @@
|
||||||
num_temps: 1
|
num_temps: 1
|
||||||
mir_op: true
|
mir_op: true
|
||||||
|
|
||||||
|
- name: GuardMultipleShapes
|
||||||
|
result_type: WordSized
|
||||||
|
operands:
|
||||||
|
object: WordSized
|
||||||
|
shapeList: WordSized
|
||||||
|
num_temps: 4
|
||||||
|
mir_op: true
|
||||||
|
|
||||||
- name: GuardProto
|
- name: GuardProto
|
||||||
operands:
|
operands:
|
||||||
object: WordSized
|
object: WordSized
|
||||||
|
|
|
@ -4456,6 +4456,25 @@ void LIRGenerator::visitGuardShape(MGuardShape* ins) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LIRGenerator::visitGuardMultipleShapes(MGuardMultipleShapes* ins) {
|
||||||
|
MOZ_ASSERT(ins->object()->type() == MIRType::Object);
|
||||||
|
|
||||||
|
if (JitOptions.spectreObjectMitigations) {
|
||||||
|
auto* lir = new (alloc()) LGuardMultipleShapes(
|
||||||
|
useRegisterAtStart(ins->object()), useRegister(ins->shapeList()),
|
||||||
|
temp(), temp(), temp(), temp());
|
||||||
|
assignSnapshot(lir, ins->bailoutKind());
|
||||||
|
defineReuseInput(lir, ins, 0);
|
||||||
|
} else {
|
||||||
|
auto* lir = new (alloc()) LGuardMultipleShapes(
|
||||||
|
useRegister(ins->object()), useRegister(ins->shapeList()), temp(),
|
||||||
|
temp(), temp(), LDefinition::BogusTemp());
|
||||||
|
assignSnapshot(lir, ins->bailoutKind());
|
||||||
|
add(lir, ins);
|
||||||
|
redefine(ins, ins->object());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LIRGenerator::visitGuardProto(MGuardProto* ins) {
|
void LIRGenerator::visitGuardProto(MGuardProto* ins) {
|
||||||
MOZ_ASSERT(ins->object()->type() == MIRType::Object);
|
MOZ_ASSERT(ins->object()->type() == MIRType::Object);
|
||||||
MOZ_ASSERT(ins->expected()->type() == MIRType::Object);
|
MOZ_ASSERT(ins->expected()->type() == MIRType::Object);
|
||||||
|
|
|
@ -6261,6 +6261,13 @@ MDefinition::AliasType MGuardShape::mightAlias(const MDefinition* store) const {
|
||||||
return MInstruction::mightAlias(store);
|
return MInstruction::mightAlias(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AliasSet MGuardMultipleShapes::getAliasSet() const {
|
||||||
|
// Note: This instruction loads the elements of the ListObject used to
|
||||||
|
// store the list of shapes, but that object is internal and not exposed
|
||||||
|
// to script, so it doesn't have to be in the alias set.
|
||||||
|
return AliasSet::Load(AliasSet::ObjectFields);
|
||||||
|
}
|
||||||
|
|
||||||
MDefinition* MGuardIsNotProxy::foldsTo(TempAllocator& alloc) {
|
MDefinition* MGuardIsNotProxy::foldsTo(TempAllocator& alloc) {
|
||||||
KnownClass known = GetObjectKnownClass(object());
|
KnownClass known = GetObjectKnownClass(object());
|
||||||
if (known == KnownClass::None) {
|
if (known == KnownClass::None) {
|
||||||
|
|
|
@ -1382,6 +1382,16 @@
|
||||||
alias_set: custom
|
alias_set: custom
|
||||||
might_alias: custom
|
might_alias: custom
|
||||||
|
|
||||||
|
- name: GuardMultipleShapes
|
||||||
|
operands:
|
||||||
|
object: Object
|
||||||
|
shapeList: Object
|
||||||
|
result_type: Object
|
||||||
|
guard: true
|
||||||
|
movable: true
|
||||||
|
congruent_to: if_operands_equal
|
||||||
|
alias_set: custom
|
||||||
|
|
||||||
- name: GuardProto
|
- name: GuardProto
|
||||||
gen_boilerplate: false
|
gen_boilerplate: false
|
||||||
|
|
||||||
|
|
|
@ -424,6 +424,18 @@ bool WarpCacheIRTranspiler::emitGuardShape(ObjOperandId objId,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WarpCacheIRTranspiler::emitGuardMultipleShapes(ObjOperandId objId,
|
||||||
|
uint32_t shapesOffset) {
|
||||||
|
MDefinition* def = getOperand(objId);
|
||||||
|
MInstruction* shapeList = objectStubField(shapesOffset);
|
||||||
|
|
||||||
|
auto* ins = MGuardMultipleShapes::New(alloc(), def, shapeList);
|
||||||
|
add(ins);
|
||||||
|
|
||||||
|
setOperand(objId, ins);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool WarpCacheIRTranspiler::emitGuardNullProto(ObjOperandId objId) {
|
bool WarpCacheIRTranspiler::emitGuardNullProto(ObjOperandId objId) {
|
||||||
MDefinition* def = getOperand(objId);
|
MDefinition* def = getOperand(objId);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче