Bug 1215600 - Make IonBuilder::testGlobalLexicalBinding() work if there's no type information r=shu

This commit is contained in:
Jon Coppeard 2016-01-20 10:13:14 +00:00
parent a26f8fc5cc
commit 4650d6b70f
2 changed files with 48 additions and 20 deletions

View File

@ -0,0 +1,23 @@
lfcode = Array()
lfcode.push("5")
lfcode.push("")
lfcode.push("3")
lfcode.push("oomTest(()=>{gc()})")
for (let i = 0; i < 10; i++) {
file = lfcode.shift()
loadFile(file)
}
function loadFile(lfVarx) {
try {
if (lfVarx.length != 1)
switch (lfRunTypeId) {
case 3:
function newFunc(x) Function(x)()
newFunc(lfVarx)
case 5:
for (lfLocal in this);
}
isNaN();
lfRunTypeId = parseInt(lfVarx);
} catch (lfVare) {}
}

View File

@ -8298,27 +8298,32 @@ IonBuilder::testGlobalLexicalBinding(PropertyName* name)
jsid id = NameToId(name); jsid id = NameToId(name);
if (analysisContext) if (analysisContext)
lexicalKey->ensureTrackedProperty(analysisContext, id); lexicalKey->ensureTrackedProperty(analysisContext, id);
if (!lexicalKey->unknownProperties()) {
// If the property is not found on the global lexical scope but it is // If the property is not found on the global lexical scope but it is found
// found on the global and is configurable, freeze the typeset for its // on the global and is configurable, try to freeze the typeset for its
// non-existence. // non-existence. If we don't have type information then fail.
// //
// In the case that it is found on the global but is non-configurable, // In the case that it is found on the global but is non-configurable,
// the binding cannot be shadowed by a global lexical binding. // the binding cannot be shadowed by a global lexical binding.
HeapTypeSetKey lexicalProperty = lexicalKey->property(id); Maybe<HeapTypeSetKey> lexicalProperty;
Shape* shape = obj->lookupPure(name); if (!lexicalKey->unknownProperties())
if (shape) { lexicalProperty.emplace(lexicalKey->property(id));
if ((JSOp(*pc) != JSOP_GETGNAME && !shape->writable()) || Shape* shape = obj->lookupPure(name);
obj->getSlot(shape->slot()).isMagic(JS_UNINITIALIZED_LEXICAL)) if (shape) {
{ if ((JSOp(*pc) != JSOP_GETGNAME && !shape->writable()) ||
return nullptr; obj->getSlot(shape->slot()).isMagic(JS_UNINITIALIZED_LEXICAL))
} {
} else { return nullptr;
shape = script()->global().lookupPure(name);
if (!shape || shape->configurable())
MOZ_ALWAYS_FALSE(lexicalProperty.isOwnProperty(constraints()));
obj = &script()->global();
} }
} else {
shape = script()->global().lookupPure(name);
if (!shape || shape->configurable()) {
if (lexicalProperty.isSome())
MOZ_ALWAYS_FALSE(lexicalProperty->isOwnProperty(constraints()));
else
return nullptr;
}
obj = &script()->global();
} }
return obj; return obj;