Bug 748119 - Read barrier for js::types::Type (r=bhackett)

This commit is contained in:
Bill McCloskey 2012-05-07 10:12:52 -07:00
parent b915404490
commit cc31724901
2 changed files with 30 additions and 12 deletions

View File

@ -107,10 +107,7 @@ class Type
return data > JSVAL_TYPE_UNKNOWN;
}
TypeObjectKey *objectKey() const {
JS_ASSERT(isObject());
return (TypeObjectKey *) data;
}
inline TypeObjectKey *objectKey() const;
/* Accessors for JSObject types */
@ -118,10 +115,7 @@ class Type
return isObject() && !!(data & 1);
}
JSObject *singleObject() const {
JS_ASSERT(isSingleObject());
return (JSObject *) (data ^ 1);
}
inline JSObject *singleObject() const;
/* Accessors for TypeObject types */
@ -129,10 +123,7 @@ class Type
return isObject() && !(data & 1);
}
TypeObject *typeObject() const {
JS_ASSERT(isTypeObject());
return (TypeObject *) data;
}
inline TypeObject *typeObject() const;
bool operator == (Type o) const { return data == o.data; }
bool operator != (Type o) const { return data != o.data; }

View File

@ -1014,6 +1014,33 @@ HashSetLookup(U **values, unsigned count, T key)
return NULL;
}
inline TypeObjectKey *
Type::objectKey() const
{
JS_ASSERT(isObject());
if (isTypeObject())
TypeObject::readBarrier((TypeObject *) data);
else
JSObject::readBarrier((JSObject *) (data ^ 1));
return (TypeObjectKey *) data;
}
inline JSObject *
Type::singleObject() const
{
JS_ASSERT(isSingleObject());
JSObject::readBarrier((JSObject *) (data ^ 1));
return (JSObject *) (data ^ 1);
}
inline TypeObject *
Type::typeObject() const
{
JS_ASSERT(isTypeObject());
TypeObject::readBarrier((TypeObject *) data);
return (TypeObject *) data;
}
inline bool
TypeSet::hasType(Type type)
{