Bug 868890 - Correctly generate barrier when accessing undefined properties of objects whose prototype also has the property, r=dvander.

This commit is contained in:
Brian Hackett 2013-05-08 17:25:24 -06:00
parent 2cb09b0e04
commit ad89a86451

View File

@ -2420,13 +2420,16 @@ ion::PropertyReadNeedsTypeBarrier(JSContext *cx, types::TypeObject *object, Prop
if (!TypeSetIncludes(observed, MIRType_Value, property))
return true;
// Type information for global objects does not reflect the initial
// 'undefined' value of variables declared with 'var'. Until the variable
// is assigned a value other than undefined, a barrier is required.
if (property->empty() && name && object->singleton && object->singleton->isNative()) {
// Type information for singleton objects is not required to reflect the
// initial 'undefined' value for native properties, in particular global
// variables declared with 'var'. Until the property is assigned a value
// other than undefined, a barrier is required.
if (name && object->singleton && object->singleton->isNative()) {
Shape *shape = object->singleton->nativeLookup(cx, name);
if (shape && shape->hasDefaultGetter()) {
JS_ASSERT(object->singleton->nativeGetSlot(shape->slot()).isUndefined());
if (shape &&
shape->hasDefaultGetter() &&
object->singleton->nativeGetSlot(shape->slot()).isUndefined())
{
return true;
}
}