Bug 1063598 - Infer constant properties even when the type property has not yet been instantiated, r=jandem.

This commit is contained in:
Brian Hackett 2014-09-07 10:27:31 -06:00
parent e288a72efd
commit 97130a2dda

View File

@ -1752,20 +1752,20 @@ HeapTypeSetKey::constant(CompilerConstraintList *constraints, Value *valOut)
if (nonData(constraints)) if (nonData(constraints))
return false; return false;
if (!maybeTypes())
return false;
if (maybeTypes()->nonConstantProperty())
return false;
// Only singleton object properties can be marked as constants. // Only singleton object properties can be marked as constants.
JS_ASSERT(object()->singleton()); JSObject *obj = object()->singleton();
if (!obj || !obj->isNative())
return false;
if (maybeTypes() && maybeTypes()->nonConstantProperty())
return false;
// Get the current value of the property. // Get the current value of the property.
Shape *shape = object()->singleton()->nativeLookupPure(id()); Shape *shape = obj->nativeLookupPure(id());
if (!shape) if (!shape || !shape->hasDefaultGetter() || !shape->hasSlot() || shape->hadOverwrite())
return false; return false;
Value val = object()->singleton()->nativeGetSlot(shape->slot());
Value val = obj->nativeGetSlot(shape->slot());
// If the value is a pointer to an object in the nursery, don't optimize. // If the value is a pointer to an object in the nursery, don't optimize.
if (val.isGCThing() && IsInsideNursery(val.toGCThing())) if (val.isGCThing() && IsInsideNursery(val.toGCThing()))