зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1131996 - Part 3: Support out-of-bounds read access on arguments objects in Warp. r=iain
Transpile the CacheIR operation from part 2. Differential Revision: https://phabricator.services.mozilla.com/D129621
This commit is contained in:
Родитель
4576174865
Коммит
3013e201cd
|
@ -1799,7 +1799,7 @@
|
|||
|
||||
- name: LoadArgumentsObjectArgHoleResult
|
||||
shared: true
|
||||
transpile: false
|
||||
transpile: true
|
||||
cost_estimate: 2
|
||||
args:
|
||||
obj: ObjId
|
||||
|
|
|
@ -7487,6 +7487,18 @@ void CodeGenerator::visitLoadArgumentsObjectArg(LLoadArgumentsObjectArg* lir) {
|
|||
bailoutFrom(&bail, lir->snapshot());
|
||||
}
|
||||
|
||||
void CodeGenerator::visitLoadArgumentsObjectArgHole(
|
||||
LLoadArgumentsObjectArgHole* lir) {
|
||||
Register temp = ToRegister(lir->temp0());
|
||||
Register argsObj = ToRegister(lir->argsObject());
|
||||
Register index = ToRegister(lir->index());
|
||||
ValueOperand out = ToOutValue(lir);
|
||||
|
||||
Label bail;
|
||||
masm.loadArgumentsObjectElementHole(argsObj, index, out, temp, &bail);
|
||||
bailoutFrom(&bail, lir->snapshot());
|
||||
}
|
||||
|
||||
void CodeGenerator::visitArgumentsObjectLength(LArgumentsObjectLength* lir) {
|
||||
Register argsObj = ToRegister(lir->argsObject());
|
||||
Register out = ToRegister(lir->output());
|
||||
|
|
|
@ -414,6 +414,14 @@
|
|||
index: WordSized
|
||||
num_temps: 1
|
||||
|
||||
# Load an element from an arguments object. Handles out-of-bounds accesses.
|
||||
- name: LoadArgumentsObjectArgHole
|
||||
result_type: BoxedValue
|
||||
operands:
|
||||
argsObject: WordSized
|
||||
index: WordSized
|
||||
num_temps: 1
|
||||
|
||||
# Return |arguments.length| unless it has been overridden.
|
||||
- name: ArgumentsObjectLength
|
||||
result_type: WordSized
|
||||
|
|
|
@ -371,6 +371,20 @@ void LIRGenerator::visitLoadArgumentsObjectArg(MLoadArgumentsObjectArg* ins) {
|
|||
defineBox(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitLoadArgumentsObjectArgHole(
|
||||
MLoadArgumentsObjectArgHole* ins) {
|
||||
MDefinition* argsObj = ins->argsObject();
|
||||
MOZ_ASSERT(argsObj->type() == MIRType::Object);
|
||||
|
||||
MDefinition* index = ins->index();
|
||||
MOZ_ASSERT(index->type() == MIRType::Int32);
|
||||
|
||||
auto* lir = new (alloc()) LLoadArgumentsObjectArgHole(
|
||||
useRegister(argsObj), useRegister(index), temp());
|
||||
assignSnapshot(lir, ins->bailoutKind());
|
||||
defineBox(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitArgumentsObjectLength(MArgumentsObjectLength* ins) {
|
||||
MDefinition* argsObj = ins->argsObject();
|
||||
MOZ_ASSERT(argsObj->type() == MIRType::Object);
|
||||
|
|
|
@ -3203,6 +3203,10 @@ AliasSet MLoadArgumentsObjectArg::getAliasSet() const {
|
|||
return AliasSet::Load(AliasSet::Any);
|
||||
}
|
||||
|
||||
AliasSet MLoadArgumentsObjectArgHole::getAliasSet() const {
|
||||
return AliasSet::Load(AliasSet::Any);
|
||||
}
|
||||
|
||||
AliasSet MArgumentsObjectLength::getAliasSet() const {
|
||||
return AliasSet::Load(AliasSet::ObjectFields | AliasSet::FixedSlot |
|
||||
AliasSet::DynamicSlot);
|
||||
|
|
|
@ -431,6 +431,18 @@
|
|||
congruent_to: if_operands_equal
|
||||
alias_set: custom
|
||||
|
||||
# Load |arguments[index]| from a mapped or unmapped arguments object. Bails out
|
||||
# if any elements were overridden or deleted. Returns undefined if the index is
|
||||
# out of bounds.
|
||||
- name: LoadArgumentsObjectArgHole
|
||||
operands:
|
||||
argsObject: Object
|
||||
index: Int32
|
||||
result_type: Value
|
||||
guard: true
|
||||
congruent_to: if_operands_equal
|
||||
alias_set: custom
|
||||
|
||||
# Load |arguments.length|. Bails out if the length has been overriden.
|
||||
- name: ArgumentsObjectLength
|
||||
operands:
|
||||
|
|
|
@ -1578,6 +1578,18 @@ bool WarpCacheIRTranspiler::emitLoadArgumentsObjectArgResult(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitLoadArgumentsObjectArgHoleResult(
|
||||
ObjOperandId objId, Int32OperandId indexId) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
MDefinition* index = getOperand(indexId);
|
||||
|
||||
auto* load = MLoadArgumentsObjectArgHole::New(alloc(), obj, index);
|
||||
add(load);
|
||||
|
||||
pushResult(load);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitLoadArgumentsObjectLengthResult(
|
||||
ObjOperandId objId) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
|
|
Загрузка…
Ссылка в новой задаче