зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1372182 part 7 - Inline some more functions. r=anba
This commit is contained in:
Родитель
9d353fa50b
Коммит
733406cbad
|
@ -685,7 +685,7 @@ class HeapSlot : public WriteBarrieredBase<Value>
|
|||
const Value& target) const;
|
||||
#endif
|
||||
|
||||
void set(NativeObject* owner, Kind kind, uint32_t slot, const Value& v) {
|
||||
MOZ_ALWAYS_INLINE void set(NativeObject* owner, Kind kind, uint32_t slot, const Value& v) {
|
||||
MOZ_ASSERT(preconditionForSet(owner, kind, slot));
|
||||
pre();
|
||||
value = v;
|
||||
|
|
|
@ -3554,6 +3554,12 @@ JSObject::uninlinedIsProxy() const
|
|||
return is<ProxyObject>();
|
||||
}
|
||||
|
||||
bool
|
||||
JSObject::uninlinedNonProxyIsExtensible() const
|
||||
{
|
||||
return nonProxyIsExtensible();
|
||||
}
|
||||
|
||||
void
|
||||
JSObject::dump(FILE* fp) const
|
||||
{
|
||||
|
|
|
@ -504,6 +504,7 @@ class JSObject : public js::gc::Cell
|
|||
// places that want it (JITs and the like), and it'd be a pain to mark them
|
||||
// all as friends.
|
||||
inline bool nonProxyIsExtensible() const;
|
||||
bool uninlinedNonProxyIsExtensible() const;
|
||||
|
||||
public:
|
||||
/*
|
||||
|
|
|
@ -420,7 +420,7 @@ NativeObject::copy(JSContext* cx, gc::AllocKind kind, gc::InitialHeap heap,
|
|||
return obj;
|
||||
}
|
||||
|
||||
inline void
|
||||
MOZ_ALWAYS_INLINE void
|
||||
NativeObject::setSlotWithType(JSContext* cx, Shape* shape,
|
||||
const Value& value, bool overwriting)
|
||||
{
|
||||
|
|
|
@ -800,10 +800,10 @@ class NativeObject : public ShapedObject
|
|||
|
||||
public:
|
||||
/* Add a property whose id is not yet in this scope. */
|
||||
static Shape* addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||
JSGetterOp getter, JSSetterOp setter,
|
||||
uint32_t slot, unsigned attrs, unsigned flags,
|
||||
bool allowDictionary = true);
|
||||
static MOZ_ALWAYS_INLINE Shape* addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||
JSGetterOp getter, JSSetterOp setter,
|
||||
uint32_t slot, unsigned attrs, unsigned flags,
|
||||
bool allowDictionary = true);
|
||||
|
||||
/* Add a data property whose id is not yet in this scope. */
|
||||
static Shape* addDataProperty(JSContext* cx, HandleNativeObject obj,
|
||||
|
@ -901,36 +901,36 @@ class NativeObject : public ShapedObject
|
|||
return getSlotAddressUnchecked(slot);
|
||||
}
|
||||
|
||||
HeapSlot& getSlotRef(uint32_t slot) {
|
||||
MOZ_ALWAYS_INLINE HeapSlot& getSlotRef(uint32_t slot) {
|
||||
MOZ_ASSERT(slotInRange(slot));
|
||||
return *getSlotAddress(slot);
|
||||
}
|
||||
|
||||
const HeapSlot& getSlotRef(uint32_t slot) const {
|
||||
MOZ_ALWAYS_INLINE const HeapSlot& getSlotRef(uint32_t slot) const {
|
||||
MOZ_ASSERT(slotInRange(slot));
|
||||
return *getSlotAddress(slot);
|
||||
}
|
||||
|
||||
// Check requirements on values stored to this object.
|
||||
inline void checkStoredValue(const Value& v) {
|
||||
MOZ_ALWAYS_INLINE void checkStoredValue(const Value& v) {
|
||||
MOZ_ASSERT(IsObjectValueInCompartment(v, compartment()));
|
||||
MOZ_ASSERT(AtomIsMarked(zoneFromAnyThread(), v));
|
||||
}
|
||||
|
||||
void setSlot(uint32_t slot, const Value& value) {
|
||||
MOZ_ALWAYS_INLINE void setSlot(uint32_t slot, const Value& value) {
|
||||
MOZ_ASSERT(slotInRange(slot));
|
||||
checkStoredValue(value);
|
||||
getSlotRef(slot).set(this, HeapSlot::Slot, slot, value);
|
||||
}
|
||||
|
||||
void initSlot(uint32_t slot, const Value& value) {
|
||||
MOZ_ALWAYS_INLINE void initSlot(uint32_t slot, const Value& value) {
|
||||
MOZ_ASSERT(getSlot(slot).isUndefined());
|
||||
MOZ_ASSERT(slotInRange(slot));
|
||||
checkStoredValue(value);
|
||||
initSlotUnchecked(slot, value);
|
||||
}
|
||||
|
||||
void initSlotUnchecked(uint32_t slot, const Value& value) {
|
||||
MOZ_ALWAYS_INLINE void initSlotUnchecked(uint32_t slot, const Value& value) {
|
||||
getSlotAddressUnchecked(slot)->init(this, HeapSlot::Slot, slot, value);
|
||||
}
|
||||
|
||||
|
@ -964,30 +964,30 @@ class NativeObject : public ShapedObject
|
|||
static bool rollbackProperties(JSContext* cx, HandleNativeObject obj,
|
||||
uint32_t slotSpan);
|
||||
|
||||
inline void setSlotWithType(JSContext* cx, Shape* shape,
|
||||
const Value& value, bool overwriting = true);
|
||||
MOZ_ALWAYS_INLINE void setSlotWithType(JSContext* cx, Shape* shape,
|
||||
const Value& value, bool overwriting = true);
|
||||
|
||||
inline const Value& getReservedSlot(uint32_t index) const {
|
||||
MOZ_ALWAYS_INLINE const Value& getReservedSlot(uint32_t index) const {
|
||||
MOZ_ASSERT(index < JSSLOT_FREE(getClass()));
|
||||
return getSlot(index);
|
||||
}
|
||||
|
||||
const HeapSlot& getReservedSlotRef(uint32_t index) const {
|
||||
MOZ_ALWAYS_INLINE const HeapSlot& getReservedSlotRef(uint32_t index) const {
|
||||
MOZ_ASSERT(index < JSSLOT_FREE(getClass()));
|
||||
return getSlotRef(index);
|
||||
}
|
||||
|
||||
HeapSlot& getReservedSlotRef(uint32_t index) {
|
||||
MOZ_ALWAYS_INLINE HeapSlot& getReservedSlotRef(uint32_t index) {
|
||||
MOZ_ASSERT(index < JSSLOT_FREE(getClass()));
|
||||
return getSlotRef(index);
|
||||
}
|
||||
|
||||
void initReservedSlot(uint32_t index, const Value& v) {
|
||||
MOZ_ALWAYS_INLINE void initReservedSlot(uint32_t index, const Value& v) {
|
||||
MOZ_ASSERT(index < JSSLOT_FREE(getClass()));
|
||||
initSlot(index, v);
|
||||
}
|
||||
|
||||
void setReservedSlot(uint32_t index, const Value& v) {
|
||||
MOZ_ALWAYS_INLINE void setReservedSlot(uint32_t index, const Value& v) {
|
||||
MOZ_ASSERT(index < JSSLOT_FREE(getClass()));
|
||||
setSlot(index, v);
|
||||
}
|
||||
|
|
|
@ -333,6 +333,30 @@ Shape::searchNoHashify(Shape* start, jsid id)
|
|||
return start->searchLinear(id);
|
||||
}
|
||||
|
||||
/* static */ MOZ_ALWAYS_INLINE Shape*
|
||||
NativeObject::addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||
GetterOp getter, SetterOp setter, uint32_t slot, unsigned attrs,
|
||||
unsigned flags, bool allowDictionary)
|
||||
{
|
||||
MOZ_ASSERT(!JSID_IS_VOID(id));
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
MOZ_ASSERT(obj->uninlinedNonProxyIsExtensible());
|
||||
MOZ_ASSERT(!obj->containsPure(id));
|
||||
|
||||
AutoKeepShapeTables keep(cx);
|
||||
ShapeTable::Entry* entry = nullptr;
|
||||
if (obj->inDictionaryMode()) {
|
||||
ShapeTable* table = obj->lastProperty()->ensureTableForDictionary(cx, keep);
|
||||
if (!table)
|
||||
return nullptr;
|
||||
entry = &table->search<MaybeAdding::Adding>(id, keep);
|
||||
}
|
||||
|
||||
return addPropertyInternal(cx, obj, id, getter, setter, slot, attrs, flags, entry,
|
||||
allowDictionary, keep);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* vm_Shape_inl_h */
|
||||
|
|
|
@ -418,30 +418,6 @@ js::NativeObject::toDictionaryMode(JSContext* cx, HandleNativeObject obj)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */ Shape*
|
||||
NativeObject::addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||
GetterOp getter, SetterOp setter, uint32_t slot, unsigned attrs,
|
||||
unsigned flags, bool allowDictionary)
|
||||
{
|
||||
MOZ_ASSERT(!JSID_IS_VOID(id));
|
||||
MOZ_ASSERT(getter != JS_PropertyStub);
|
||||
MOZ_ASSERT(setter != JS_StrictPropertyStub);
|
||||
MOZ_ASSERT(obj->nonProxyIsExtensible());
|
||||
MOZ_ASSERT(!obj->containsPure(id));
|
||||
|
||||
AutoKeepShapeTables keep(cx);
|
||||
ShapeTable::Entry* entry = nullptr;
|
||||
if (obj->inDictionaryMode()) {
|
||||
ShapeTable* table = obj->lastProperty()->ensureTableForDictionary(cx, keep);
|
||||
if (!table)
|
||||
return nullptr;
|
||||
entry = &table->search<MaybeAdding::Adding>(id, keep);
|
||||
}
|
||||
|
||||
return addPropertyInternal(cx, obj, id, getter, setter, slot, attrs, flags, entry,
|
||||
allowDictionary, keep);
|
||||
}
|
||||
|
||||
static bool
|
||||
ShouldConvertToDictionary(NativeObject* obj)
|
||||
{
|
||||
|
|
|
@ -433,7 +433,7 @@ void AddTypePropertyId(JSContext* cx, ObjectGroup* group, JSObject* obj, jsid id
|
|||
void AddTypePropertyId(JSContext* cx, ObjectGroup* group, JSObject* obj, jsid id, const Value& value);
|
||||
|
||||
/* Add a possible type for a property of obj. */
|
||||
inline void
|
||||
MOZ_ALWAYS_INLINE void
|
||||
AddTypePropertyId(JSContext* cx, JSObject* obj, jsid id, TypeSet::Type type)
|
||||
{
|
||||
id = IdToTypeId(id);
|
||||
|
@ -441,7 +441,7 @@ AddTypePropertyId(JSContext* cx, JSObject* obj, jsid id, TypeSet::Type type)
|
|||
AddTypePropertyId(cx, obj->group(), obj, id, type);
|
||||
}
|
||||
|
||||
inline void
|
||||
MOZ_ALWAYS_INLINE void
|
||||
AddTypePropertyId(JSContext* cx, JSObject* obj, jsid id, const Value& value)
|
||||
{
|
||||
id = IdToTypeId(id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче