Bug 1012798 part 3. When doing a DOM slot get in Ion, check whether we're doing a get of a constant value on a singleton object (e.g. .window) and if so just use the constant value directly. r=efaust

This commit is contained in:
Boris Zbarsky 2014-12-09 14:44:37 -05:00
parent 30dbf04fde
commit d29d4a299d

View File

@ -9704,6 +9704,16 @@ IonBuilder::getPropTryCommonGetter(bool *emitted, MDefinition *obj, PropertyName
const JSJitInfo *jitinfo = commonGetter->jitInfo();
MInstruction *get;
if (jitinfo->isAlwaysInSlot) {
// If our object is a singleton and we know the property is
// constant (which is true if and only if the get doesn't alias
// anything), we can just read the slot here and use that constant.
JSObject *singleton = objTypes->getSingleton();
if (singleton && jitinfo->aliasSet() == JSJitInfo::AliasNone) {
size_t slot = jitinfo->slotIndex;
*emitted = true;
return pushConstant(GetReservedSlot(singleton, slot));
}
// We can't use MLoadFixedSlot here because it might not have the
// right aliasing behavior; we want to alias DOM setters as needed.
get = MGetDOMMember::New(alloc(), jitinfo, obj, guard, globalGuard);