Bug 933764 - Hide specific members of a TypeRepresentationSet r=jandem

This commit is contained in:
Nicholas D. Matsakis 2013-11-01 10:46:19 -04:00
Родитель d96a9ff104
Коммит 006bde45da
3 изменённых файлов: 29 добавлений и 15 удалений

Просмотреть файл

@ -6532,9 +6532,9 @@ IonBuilder::getElemTryScalarElemOfTypedObject(bool *emitted,
JS_ASSERT(objTypeReprs.allOfArrayKind());
// Must always be loading the same scalar type
if (elemTypeReprs.length() != 1)
if (!elemTypeReprs.singleton())
return true;
ScalarTypeRepresentation *elemTypeRepr = elemTypeReprs.get(0)->asScalar();
ScalarTypeRepresentation *elemTypeRepr = elemTypeReprs.getTypeRepresentation()->asScalar();
// Get the length.
size_t lenOfAll = objTypeReprs.arrayLength();
@ -8231,9 +8231,9 @@ IonBuilder::getPropTryScalarPropOfTypedObject(bool *emitted,
types::TemporaryTypeSet *resultTypes)
{
// Must always be loading the same scalar type
if (fieldTypeReprs.length() != 1)
if (!fieldTypeReprs.singleton())
return true;
ScalarTypeRepresentation *fieldTypeRepr = fieldTypeReprs.get(0)->asScalar();
ScalarTypeRepresentation *fieldTypeRepr = fieldTypeReprs.getTypeRepresentation()->asScalar();
// OK!
*emitted = true;
@ -8756,9 +8756,10 @@ IonBuilder::setPropTryTypedObject(bool *emitted, MDefinition *obj,
}
// Must always be storing the same scalar type
if (fieldTypeReprs.length() != 1)
if (!fieldTypeReprs.singleton())
return true;
ScalarTypeRepresentation *fieldTypeRepr = fieldTypeReprs.get(0)->asScalar();
ScalarTypeRepresentation *fieldTypeRepr =
fieldTypeReprs.getTypeRepresentation()->asScalar();
// OK!
*emitted = true;

Просмотреть файл

@ -162,20 +162,20 @@ TypeRepresentationSet::TypeRepresentationSet()
bool
TypeRepresentationSet::empty()
{
return length() == 0;
return length_ == 0;
}
size_t
TypeRepresentationSet::length()
bool
TypeRepresentationSet::singleton()
{
return length_;
return length_ == 1;
}
TypeRepresentation *
TypeRepresentationSet::get(size_t i)
TypeRepresentationSet::getTypeRepresentation()
{
JS_ASSERT(i < length());
return entries_[i];
JS_ASSERT(singleton());
return get(0);
}
bool

Просмотреть файл

@ -55,6 +55,7 @@ class TypeRepresentationSetBuilder {
class TypeRepresentationSet {
private:
friend struct TypeRepresentationSetHasher;
friend class TypeRepresentationSetBuilder;
size_t length_;
@ -62,6 +63,14 @@ class TypeRepresentationSet {
TypeRepresentationSet(size_t length, TypeRepresentation **entries);
size_t length() const {
return length_;
}
TypeRepresentation *get(uint32_t i) const {
return entries_[i];
}
public:
//////////////////////////////////////////////////////////////////////
// Constructors
@ -76,8 +85,7 @@ class TypeRepresentationSet {
// Query the set
bool empty();
size_t length();
TypeRepresentation *get(size_t i);
bool singleton();
bool allOfKind(TypeRepresentation::Kind kind);
// Returns true only when non-empty and `kind()` is
@ -99,6 +107,11 @@ class TypeRepresentationSet {
TypeRepresentation::Kind kind();
//////////////////////////////////////////////////////////////////////
// The following operations are only valid on a singleton set:
TypeRepresentation *getTypeRepresentation();
//////////////////////////////////////////////////////////////////////
// Array operations
//