зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1185961 - Properly install home object on methods in classes in lazy scripts. (r=shu)
This commit is contained in:
Родитель
240506f142
Коммит
49aef6b263
|
@ -2075,6 +2075,9 @@ Parser<FullParseHandler>::checkFunctionDefinition(HandlePropertyName funName,
|
|||
if (!funbox)
|
||||
return false;
|
||||
|
||||
if (fun->lazyScript()->needsHomeObject())
|
||||
funbox->setNeedsHomeObject();
|
||||
|
||||
if (!addFreeVariablesFromLazyFunction(fun, pc))
|
||||
return false;
|
||||
|
||||
|
@ -2395,6 +2398,8 @@ Parser<SyntaxParseHandler>::finishFunctionDefinition(Node pn, FunctionBox* funbo
|
|||
lazy->setUsesArgumentsApplyAndThis();
|
||||
if (funbox->isDerivedClassConstructor())
|
||||
lazy->setIsDerivedClassConstructor();
|
||||
if (funbox->needsHomeObject())
|
||||
lazy->setNeedsHomeObject();
|
||||
PropagateTransitiveParseFlags(funbox, lazy);
|
||||
|
||||
fun->initLazyScript(lazy);
|
||||
|
|
|
@ -2053,7 +2053,7 @@ class LazyScript : public gc::TenuredCell
|
|||
uint32_t version : 8;
|
||||
|
||||
uint32_t numFreeVariables : 24;
|
||||
uint32_t numInnerFunctions : 21;
|
||||
uint32_t numInnerFunctions : 20;
|
||||
|
||||
uint32_t generatorKindBits : 2;
|
||||
|
||||
|
@ -2069,6 +2069,7 @@ class LazyScript : public gc::TenuredCell
|
|||
uint32_t hasBeenCloned : 1;
|
||||
uint32_t treatAsRunOnce : 1;
|
||||
uint32_t isDerivedClassConstructor : 1;
|
||||
uint32_t needsHomeObject : 1;
|
||||
};
|
||||
|
||||
union {
|
||||
|
@ -2247,6 +2248,13 @@ class LazyScript : public gc::TenuredCell
|
|||
p_.isDerivedClassConstructor = true;
|
||||
}
|
||||
|
||||
bool needsHomeObject() const {
|
||||
return p_.needsHomeObject;
|
||||
}
|
||||
void setNeedsHomeObject() {
|
||||
p_.needsHomeObject = true;
|
||||
}
|
||||
|
||||
const char* filename() const {
|
||||
return scriptSource()->filename();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
var test = `
|
||||
testcase();
|
||||
function testcase() {
|
||||
var tokenCodes = {
|
||||
get try() {
|
||||
try {
|
||||
super.actual();
|
||||
} catch (e) {}
|
||||
}
|
||||
};
|
||||
var arr = [
|
||||
'try',
|
||||
];
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (tokenCodes[arr[i]] !== i) {};
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0,0,"OK");
|
Загрузка…
Ссылка в новой задаче