mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 932899 - Remove debug only stack/heap type set flags, r=jandem.
This commit is contained in:
parent
37a6f733e9
commit
7b9b512f4a
@ -1200,7 +1200,7 @@ InitArrayTypes(JSContext *cx, TypeObject *type, const Value *vector, unsigned co
|
||||
if (cx->typeInferenceEnabled() && !type->unknownProperties()) {
|
||||
AutoEnterAnalysis enter(cx);
|
||||
|
||||
TypeSet *types = type->getProperty(cx, JSID_VOID);
|
||||
HeapTypeSet *types = type->getProperty(cx, JSID_VOID);
|
||||
if (!types)
|
||||
return false;
|
||||
|
||||
|
@ -397,10 +397,8 @@ TypeSet::addTypesToConstraint(JSContext *cx, TypeConstraint *constraint)
|
||||
}
|
||||
|
||||
void
|
||||
TypeSet::add(JSContext *cx, TypeConstraint *constraint, bool callExisting)
|
||||
ConstraintTypeSet::add(JSContext *cx, TypeConstraint *constraint, bool callExisting)
|
||||
{
|
||||
JS_ASSERT(isStackSet() || isHeapSet());
|
||||
|
||||
if (!constraint) {
|
||||
/* OOM failure while constructing the constraint. */
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
@ -485,9 +483,7 @@ TypeSet::clone(LifoAlloc *alloc, TemporaryTypeSet *result) const
|
||||
PodCopy(newSet, objectSet, capacity);
|
||||
}
|
||||
|
||||
uint32_t newFlags = flags & ~(TYPE_FLAG_STACK_SET | TYPE_FLAG_HEAP_SET);
|
||||
|
||||
new(result) TemporaryTypeSet(newFlags, capacity ? newSet : objectSet);
|
||||
new(result) TemporaryTypeSet(flags, capacity ? newSet : objectSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1352,7 +1348,7 @@ ObjectStateChange(ExclusiveContext *cxArg, TypeObject *object, bool markingUnkno
|
||||
return;
|
||||
|
||||
/* All constraints listening to state changes are on the empty id. */
|
||||
TypeSet *types = object->maybeGetProperty(JSID_EMPTY);
|
||||
HeapTypeSet *types = object->maybeGetProperty(JSID_EMPTY);
|
||||
|
||||
/* Mark as unknown after getting the types, to avoid assertion. */
|
||||
if (markingUnknown)
|
||||
@ -2172,7 +2168,7 @@ TypeCompartment::markSetsUnknown(JSContext *cx, TypeObject *target)
|
||||
* types can't be done while iterating over cells as it can potentially make
|
||||
* new type objects as well or trigger GC.
|
||||
*/
|
||||
Vector<TypeSet *> pending(cx);
|
||||
Vector<ConstraintTypeSet *> pending(cx);
|
||||
for (gc::CellIter i(cx->zone(), gc::FINALIZE_TYPE_OBJECT); !i.done(); i.next()) {
|
||||
TypeObject *object = i.get<TypeObject>();
|
||||
unsigned count = object->getPropertyCount();
|
||||
@ -2192,7 +2188,7 @@ TypeCompartment::markSetsUnknown(JSContext *cx, TypeObject *target)
|
||||
RootedScript script(cx, i.get<JSScript>());
|
||||
if (script->types) {
|
||||
unsigned count = TypeScript::NumTypeSets(script);
|
||||
TypeSet *typeArray = script->types->typeArray();
|
||||
StackTypeSet *typeArray = script->types->typeArray();
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
if (typeArray[i].hasType(Type::ObjectType(target)))
|
||||
typeArray[i].addType(cx, Type::AnyObjectType());
|
||||
@ -2761,7 +2757,7 @@ InlineAddTypeProperty(ExclusiveContext *cx, TypeObject *obj, jsid id, Type type)
|
||||
|
||||
AutoEnterAnalysis enter(cx);
|
||||
|
||||
TypeSet *types = obj->getProperty(cx, id);
|
||||
HeapTypeSet *types = obj->getProperty(cx, id);
|
||||
if (!types || types->hasType(type))
|
||||
return;
|
||||
|
||||
@ -2811,7 +2807,7 @@ TypeObject::markPropertyConfigured(ExclusiveContext *cx, jsid id)
|
||||
|
||||
id = IdToTypeId(id);
|
||||
|
||||
TypeSet *types = getProperty(cx, id);
|
||||
HeapTypeSet *types = getProperty(cx, id);
|
||||
if (types)
|
||||
types->setConfiguredProperty(cx);
|
||||
}
|
||||
@ -2832,7 +2828,7 @@ TypeObject::markStateChange(ExclusiveContext *cxArg)
|
||||
return;
|
||||
|
||||
AutoEnterAnalysis enter(cxArg);
|
||||
TypeSet *types = maybeGetProperty(JSID_EMPTY);
|
||||
HeapTypeSet *types = maybeGetProperty(JSID_EMPTY);
|
||||
if (types) {
|
||||
if (JSContext *cx = cxArg->maybeJSContext()) {
|
||||
TypeConstraint *constraint = types->constraintList;
|
||||
@ -3186,10 +3182,10 @@ types::AddClearDefiniteFunctionUsesInScript(JSContext *cx, TypeObject *type,
|
||||
TypeObjectKey *calleeKey = Type::ObjectType(calleeScript->function()).objectKey();
|
||||
|
||||
unsigned count = TypeScript::NumTypeSets(script);
|
||||
TypeSet *typeArray = script->types->typeArray();
|
||||
StackTypeSet *typeArray = script->types->typeArray();
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
TypeSet *types = &typeArray[i];
|
||||
StackTypeSet *types = &typeArray[i];
|
||||
if (!types->unknownObject() && types->getObjectCount() == 1) {
|
||||
if (calleeKey != types->getObject(0)) {
|
||||
// Also check if the object is the Function.call or
|
||||
@ -3365,7 +3361,7 @@ types::TypeMonitorResult(JSContext *cx, JSScript *script, jsbytecode *pc, const
|
||||
AutoEnterAnalysis enter(cx);
|
||||
|
||||
Type type = GetValueType(rval);
|
||||
TypeSet *types = TypeScript::BytecodeTypes(script, pc);
|
||||
StackTypeSet *types = TypeScript::BytecodeTypes(script, pc);
|
||||
if (types->hasType(type))
|
||||
return;
|
||||
|
||||
@ -3451,7 +3447,7 @@ JSScript::makeTypes(JSContext *cx)
|
||||
|
||||
unsigned count = TypeScript::NumTypeSets(this);
|
||||
|
||||
types = (TypeScript *) cx->calloc_(sizeof(TypeScript) + (sizeof(TypeSet) * count));
|
||||
types = (TypeScript *) cx->calloc_(sizeof(TypeScript) + (sizeof(StackTypeSet) * count));
|
||||
if (!types) {
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return false;
|
||||
@ -3886,7 +3882,7 @@ ExclusiveContext::getLazyType(const Class *clasp, TaggedProto proto)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
TypeSet::sweep(Zone *zone)
|
||||
ConstraintTypeSet::sweep(Zone *zone)
|
||||
{
|
||||
/*
|
||||
* Purge references to type objects that are no longer live. Type sets hold
|
||||
@ -4182,7 +4178,7 @@ TypeScript::Sweep(FreeOp *fop, JSScript *script)
|
||||
JS_ASSERT(compartment->zone()->types.inferenceEnabled);
|
||||
|
||||
unsigned num = NumTypeSets(script);
|
||||
TypeSet *typeArray = script->types->typeArray();
|
||||
StackTypeSet *typeArray = script->types->typeArray();
|
||||
|
||||
/* Remove constraints and references to dead objects from the persistent type sets. */
|
||||
for (unsigned i = 0; i < num; i++)
|
||||
|
111
js/src/jsinfer.h
111
js/src/jsinfer.h
@ -358,23 +358,6 @@ enum {
|
||||
/* Mask of normal type flags on a type set. */
|
||||
TYPE_FLAG_BASE_MASK = 0x000020ff,
|
||||
|
||||
/*
|
||||
* Flags describing the kind of type set this is.
|
||||
*
|
||||
* - StackTypeSet are associated with TypeScripts, for arguments and values
|
||||
* observed at property reads. These are implicitly frozen on compilation
|
||||
* and do not have constraints attached to them.
|
||||
*
|
||||
* - HeapTypeSet are associated with the properties of TypeObjects. These
|
||||
* may have constraints added to them to trigger invalidation of compiled
|
||||
* code.
|
||||
*
|
||||
* - TemporaryTypeSet are created during compilation and do not outlive
|
||||
* that compilation.
|
||||
*/
|
||||
TYPE_FLAG_STACK_SET = 0x00004000,
|
||||
TYPE_FLAG_HEAP_SET = 0x00008000,
|
||||
|
||||
/* Additional flags for HeapTypeSet sets. */
|
||||
|
||||
/*
|
||||
@ -485,7 +468,21 @@ class StackTypeSet;
|
||||
class HeapTypeSet;
|
||||
class TemporaryTypeSet;
|
||||
|
||||
/* Information about the set of types associated with an lvalue. */
|
||||
/*
|
||||
* Information about the set of types associated with an lvalue. There are
|
||||
* three kinds of type sets:
|
||||
*
|
||||
* - StackTypeSet are associated with TypeScripts, for arguments and values
|
||||
* observed at property reads. These are implicitly frozen on compilation
|
||||
* and do not have constraints attached to them.
|
||||
*
|
||||
* - HeapTypeSet are associated with the properties of TypeObjects. These
|
||||
* may have constraints added to them to trigger invalidation of compiled
|
||||
* code.
|
||||
*
|
||||
* - TemporaryTypeSet are created during compilation and do not outlive
|
||||
* that compilation.
|
||||
*/
|
||||
class TypeSet
|
||||
{
|
||||
protected:
|
||||
@ -497,17 +494,12 @@ class TypeSet
|
||||
|
||||
public:
|
||||
|
||||
/* Chain of constraints which propagate changes out from this type set. */
|
||||
TypeConstraint *constraintList;
|
||||
|
||||
TypeSet()
|
||||
: flags(0), objectSet(nullptr), constraintList(nullptr)
|
||||
: flags(0), objectSet(nullptr)
|
||||
{}
|
||||
|
||||
void print();
|
||||
|
||||
inline void sweep(JS::Zone *zone);
|
||||
|
||||
/* Whether this set contains a specific type. */
|
||||
inline bool hasType(Type type) const;
|
||||
|
||||
@ -536,15 +528,6 @@ class TypeSet
|
||||
/* Add a type to this set using the specified allocator. */
|
||||
inline bool addType(Type type, LifoAlloc *alloc, bool *padded = nullptr);
|
||||
|
||||
/*
|
||||
* Add a type to this set, calling any constraint handlers if this is a new
|
||||
* possible type.
|
||||
*/
|
||||
inline void addType(ExclusiveContext *cx, Type type);
|
||||
|
||||
/* Mark this type set as representing a configured property. */
|
||||
inline void setConfiguredProperty(ExclusiveContext *cx);
|
||||
|
||||
/* Get a list of all types in this set. */
|
||||
typedef Vector<Type, 1, SystemAllocPolicy> TypeList;
|
||||
bool enumerateTypes(TypeList *list);
|
||||
@ -574,13 +557,6 @@ class TypeSet
|
||||
flags |= ((slot + 1) << TYPE_FLAG_DEFINITE_SHIFT);
|
||||
}
|
||||
|
||||
bool isStackSet() {
|
||||
return flags & TYPE_FLAG_STACK_SET;
|
||||
}
|
||||
bool isHeapSet() {
|
||||
return flags & TYPE_FLAG_HEAP_SET;
|
||||
}
|
||||
|
||||
/* Whether any values in this set might have the specified type. */
|
||||
bool mightBeType(JSValueType type);
|
||||
|
||||
@ -593,12 +569,6 @@ class TypeSet
|
||||
/* Forward all types in this set to the specified constraint. */
|
||||
void addTypesToConstraint(JSContext *cx, TypeConstraint *constraint);
|
||||
|
||||
/* Add a new constraint to this set. */
|
||||
void add(JSContext *cx, TypeConstraint *constraint, bool callExisting = true);
|
||||
|
||||
inline StackTypeSet *toStackSet();
|
||||
inline HeapTypeSet *toHeapSet();
|
||||
|
||||
// Clone a type set into an arbitrary allocator.
|
||||
TemporaryTypeSet *clone(LifoAlloc *alloc) const;
|
||||
bool clone(LifoAlloc *alloc, TemporaryTypeSet *result) const;
|
||||
@ -612,16 +582,37 @@ class TypeSet
|
||||
inline void clearObjects();
|
||||
};
|
||||
|
||||
class StackTypeSet : public TypeSet
|
||||
/* Superclass common to stack and heap type sets. */
|
||||
class ConstraintTypeSet : public TypeSet
|
||||
{
|
||||
public:
|
||||
StackTypeSet() { flags |= TYPE_FLAG_STACK_SET; }
|
||||
/* Chain of constraints which propagate changes out from this type set. */
|
||||
TypeConstraint *constraintList;
|
||||
|
||||
ConstraintTypeSet() : constraintList(nullptr) {}
|
||||
|
||||
/*
|
||||
* Add a type to this set, calling any constraint handlers if this is a new
|
||||
* possible type.
|
||||
*/
|
||||
inline void addType(ExclusiveContext *cx, Type type);
|
||||
|
||||
/* Add a new constraint to this set. */
|
||||
void add(JSContext *cx, TypeConstraint *constraint, bool callExisting = true);
|
||||
|
||||
inline void sweep(JS::Zone *zone);
|
||||
};
|
||||
|
||||
class HeapTypeSet : public TypeSet
|
||||
class StackTypeSet : public ConstraintTypeSet
|
||||
{
|
||||
public:
|
||||
HeapTypeSet() { flags |= TYPE_FLAG_HEAP_SET; }
|
||||
};
|
||||
|
||||
class HeapTypeSet : public ConstraintTypeSet
|
||||
{
|
||||
public:
|
||||
/* Mark this type set as representing a configured property. */
|
||||
inline void setConfiguredProperty(ExclusiveContext *cx);
|
||||
};
|
||||
|
||||
class CompilerConstraintList;
|
||||
@ -638,7 +629,6 @@ class TemporaryTypeSet : public TypeSet
|
||||
TemporaryTypeSet(uint32_t flags, TypeObjectKey **objectSet) {
|
||||
this->flags = flags;
|
||||
this->objectSet = objectSet;
|
||||
JS_ASSERT(!isStackSet() && !isHeapSet());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -725,20 +715,6 @@ class TemporaryTypeSet : public TypeSet
|
||||
DoubleConversion convertDoubleElements(CompilerConstraintList *constraints);
|
||||
};
|
||||
|
||||
inline StackTypeSet *
|
||||
TypeSet::toStackSet()
|
||||
{
|
||||
JS_ASSERT(isStackSet());
|
||||
return (StackTypeSet *) this;
|
||||
}
|
||||
|
||||
inline HeapTypeSet *
|
||||
TypeSet::toHeapSet()
|
||||
{
|
||||
JS_ASSERT(isHeapSet());
|
||||
return (HeapTypeSet *) this;
|
||||
}
|
||||
|
||||
bool
|
||||
AddClearDefiniteGetterSetterForPrototypeChain(JSContext *cx, TypeObject *type, jsid id);
|
||||
|
||||
@ -1398,7 +1374,7 @@ struct TypeCompartment
|
||||
struct PendingWork
|
||||
{
|
||||
TypeConstraint *constraint;
|
||||
TypeSet *source;
|
||||
ConstraintTypeSet *source;
|
||||
Type type;
|
||||
};
|
||||
PendingWork *pendingArray;
|
||||
@ -1441,7 +1417,8 @@ struct TypeCompartment
|
||||
inline JSCompartment *compartment();
|
||||
|
||||
/* Add a type to register with a list of constraints. */
|
||||
inline void addPending(JSContext *cx, TypeConstraint *constraint, TypeSet *source, Type type);
|
||||
inline void addPending(JSContext *cx, TypeConstraint *constraint,
|
||||
ConstraintTypeSet *source, Type type);
|
||||
bool growPendingArray(JSContext *cx);
|
||||
|
||||
/* Resolve pending type registrations, excluding delayed ones. */
|
||||
|
@ -853,7 +853,8 @@ TypeCompartment::compartment()
|
||||
}
|
||||
|
||||
inline void
|
||||
TypeCompartment::addPending(JSContext *cx, TypeConstraint *constraint, TypeSet *source, Type type)
|
||||
TypeCompartment::addPending(JSContext *cx, TypeConstraint *constraint,
|
||||
ConstraintTypeSet *source, Type type)
|
||||
{
|
||||
JS_ASSERT(this == &cx->compartment()->types);
|
||||
JS_ASSERT(!cx->runtime()->isHeapBusy());
|
||||
@ -1198,15 +1199,12 @@ TypeSet::addType(Type type, LifoAlloc *alloc, bool *padded)
|
||||
}
|
||||
|
||||
inline void
|
||||
TypeSet::addType(ExclusiveContext *cxArg, Type type)
|
||||
ConstraintTypeSet::addType(ExclusiveContext *cxArg, Type type)
|
||||
{
|
||||
JS_ASSERT(cxArg->compartment()->activeAnalysis);
|
||||
|
||||
// Temporary type sets use a separate LifoAlloc for storage.
|
||||
JS_ASSERT(isStackSet() || isHeapSet());
|
||||
|
||||
bool added = false;
|
||||
if (!addType(type, &cxArg->typeLifoAlloc(), &added)) {
|
||||
if (!TypeSet::addType(type, &cxArg->typeLifoAlloc(), &added)) {
|
||||
cxArg->compartment()->types.setPendingNukeTypes(cxArg);
|
||||
return;
|
||||
}
|
||||
@ -1231,7 +1229,7 @@ TypeSet::addType(ExclusiveContext *cxArg, Type type)
|
||||
}
|
||||
|
||||
inline void
|
||||
TypeSet::setConfiguredProperty(ExclusiveContext *cxArg)
|
||||
HeapTypeSet::setConfiguredProperty(ExclusiveContext *cxArg)
|
||||
{
|
||||
if (flags & TYPE_FLAG_CONFIGURED_PROPERTY)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user