зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1720032 - Part 1: Mark Check{Return,This,ThisReinit} as throwing instructions. r=jandem
Check{Return,This} can throw an exception and therefore must record this in their alias set. CheckThisReinit doesn't strictly require this change, because this instruction is currently only used in situations where a resume point is constructed anway, but it seemed more consistent to handle it the same way as Check{Return,This}. Differential Revision: https://phabricator.services.mozilla.com/D119630
This commit is contained in:
Родитель
38f0e9a63e
Коммит
d0a92f7593
|
@ -0,0 +1,27 @@
|
|||
function main() {
|
||||
class Base {}
|
||||
|
||||
class Derived extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
let v = 0xffff;
|
||||
|
||||
try {
|
||||
// Ensure this statement doesn't get DCE'ed.
|
||||
v &= 0xff;
|
||||
|
||||
// Returning a primitive value throws.
|
||||
return 0;
|
||||
} catch {}
|
||||
|
||||
assertEq(v, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < 15; i++) {
|
||||
new Derived();
|
||||
}
|
||||
}
|
||||
main();
|
||||
main();
|
|
@ -0,0 +1,27 @@
|
|||
function main() {
|
||||
class Base {}
|
||||
|
||||
class Derived extends Base {
|
||||
constructor() {
|
||||
let v = 0xffff;
|
||||
|
||||
try {
|
||||
// Ensure this statement doesn't get DCE'ed.
|
||||
v &= 0xff;
|
||||
|
||||
// Accessing |this| throws when |super()| wasn't yet called.
|
||||
this;
|
||||
} catch {}
|
||||
|
||||
assertEq(v, 255);
|
||||
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < 15; i++) {
|
||||
new Derived();
|
||||
}
|
||||
}
|
||||
main();
|
||||
main();
|
|
@ -0,0 +1,27 @@
|
|||
function main() {
|
||||
class Base {}
|
||||
|
||||
class Derived extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
let v = 0xffff;
|
||||
|
||||
try {
|
||||
// Ensure this statement doesn't get DCE'ed.
|
||||
v &= 0xff;
|
||||
|
||||
// Calling |super()| twice throws an error.
|
||||
super();
|
||||
} catch {}
|
||||
|
||||
assertEq(v, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < 15; i++) {
|
||||
new Derived();
|
||||
}
|
||||
}
|
||||
main();
|
||||
main();
|
|
@ -5826,6 +5826,18 @@ AliasSet MCheckObjCoercible::getAliasSet() const {
|
|||
return AliasSet::Store(AliasSet::ExceptionState);
|
||||
}
|
||||
|
||||
AliasSet MCheckReturn::getAliasSet() const {
|
||||
return AliasSet::Store(AliasSet::ExceptionState);
|
||||
}
|
||||
|
||||
AliasSet MCheckThis::getAliasSet() const {
|
||||
return AliasSet::Store(AliasSet::ExceptionState);
|
||||
}
|
||||
|
||||
AliasSet MCheckThisReinit::getAliasSet() const {
|
||||
return AliasSet::Store(AliasSet::ExceptionState);
|
||||
}
|
||||
|
||||
AliasSet MIsPackedArray::getAliasSet() const {
|
||||
return AliasSet::Load(AliasSet::ObjectFields);
|
||||
}
|
||||
|
|
|
@ -1913,7 +1913,7 @@
|
|||
thisValue: Value
|
||||
result_type: Value
|
||||
guard: true
|
||||
alias_set: none
|
||||
alias_set: custom
|
||||
|
||||
- name: CheckThis
|
||||
operands:
|
||||
|
@ -1921,7 +1921,7 @@
|
|||
result_type: Value
|
||||
guard: true
|
||||
folds_to: custom
|
||||
alias_set: none
|
||||
alias_set: custom
|
||||
|
||||
- name: AsyncResolve
|
||||
operands:
|
||||
|
@ -1953,7 +1953,7 @@
|
|||
result_type: Value
|
||||
guard: true
|
||||
folds_to: custom
|
||||
alias_set: none
|
||||
alias_set: custom
|
||||
|
||||
- name: Generator
|
||||
gen_boilerplate: false
|
||||
|
|
|
@ -2139,20 +2139,20 @@ bool WarpBuilder::build_CheckClassHeritage(BytecodeLocation loc) {
|
|||
return resumeAfter(ins, loc);
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_CheckThis(BytecodeLocation) {
|
||||
bool WarpBuilder::build_CheckThis(BytecodeLocation loc) {
|
||||
MDefinition* def = current->pop();
|
||||
auto* ins = MCheckThis::New(alloc(), def);
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
return true;
|
||||
return resumeAfter(ins, loc);
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_CheckThisReinit(BytecodeLocation) {
|
||||
bool WarpBuilder::build_CheckThisReinit(BytecodeLocation loc) {
|
||||
MDefinition* def = current->pop();
|
||||
auto* ins = MCheckThisReinit::New(alloc(), def);
|
||||
current->add(ins);
|
||||
current->push(ins);
|
||||
return true;
|
||||
return resumeAfter(ins, loc);
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_Generator(BytecodeLocation loc) {
|
||||
|
@ -2401,7 +2401,7 @@ bool WarpBuilder::build_AsyncAwait(BytecodeLocation loc) {
|
|||
return resumeAfter(asyncAwait, loc);
|
||||
}
|
||||
|
||||
bool WarpBuilder::build_CheckReturn(BytecodeLocation) {
|
||||
bool WarpBuilder::build_CheckReturn(BytecodeLocation loc) {
|
||||
MOZ_ASSERT(!script_->noScriptRval());
|
||||
|
||||
MDefinition* returnValue = current->getSlot(info().returnValueSlot());
|
||||
|
@ -2410,7 +2410,7 @@ bool WarpBuilder::build_CheckReturn(BytecodeLocation) {
|
|||
auto* ins = MCheckReturn::New(alloc(), returnValue, thisValue);
|
||||
current->add(ins);
|
||||
current->setSlot(info().returnValueSlot(), ins);
|
||||
return true;
|
||||
return resumeAfter(ins, loc);
|
||||
}
|
||||
|
||||
void WarpBuilder::buildCheckLexicalOp(BytecodeLocation loc) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче