diff options
Diffstat (limited to 'js/src/vm/Shape.h')
-rw-r--r-- | js/src/vm/Shape.h | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 52b9197da..bb813997f 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -1264,9 +1264,10 @@ struct InitialShapeEntry bool needsSweep() { Shape* ushape = shape.unbarrieredGet(); - JSObject* protoObj = proto.proto().raw(); + TaggedProto uproto = proto.proto().unbarrieredGet(); + JSObject* protoObj = uproto.raw(); return (gc::IsAboutToBeFinalizedUnbarriered(&ushape) || - (proto.proto().isObject() && gc::IsAboutToBeFinalizedUnbarriered(&protoObj))); + (uproto.isObject() && gc::IsAboutToBeFinalizedUnbarriered(&protoObj))); } }; @@ -1356,9 +1357,10 @@ struct StackShape void trace(JSTracer* trc); }; -template <typename Outer> -class StackShapeOperations { - const StackShape& ss() const { return static_cast<const Outer*>(this)->get(); } +template <typename Wrapper> +class WrappedPtrOperations<StackShape, Wrapper> +{ + const StackShape& ss() const { return static_cast<const Wrapper*>(this)->get(); } public: bool hasSlot() const { return ss().hasSlot(); } @@ -1370,9 +1372,11 @@ class StackShapeOperations { uint8_t attrs() const { return ss().attrs; } }; -template <typename Outer> -class MutableStackShapeOperations : public StackShapeOperations<Outer> { - StackShape& ss() { return static_cast<Outer*>(this)->get(); } +template <typename Wrapper> +class MutableWrappedPtrOperations<StackShape, Wrapper> + : public WrappedPtrOperations<StackShape, Wrapper> +{ + StackShape& ss() { return static_cast<Wrapper*>(this)->get(); } public: void updateGetterSetter(GetterOp rawGetter, SetterOp rawSetter) { @@ -1383,19 +1387,6 @@ class MutableStackShapeOperations : public StackShapeOperations<Outer> { void setAttrs(uint8_t attrs) { ss().attrs = attrs; } }; -template <> -class RootedBase<StackShape> : public MutableStackShapeOperations<JS::Rooted<StackShape>> -{}; - -template <> -class HandleBase<StackShape> : public StackShapeOperations<JS::Handle<StackShape>> -{}; - -template <> -class MutableHandleBase<StackShape> - : public MutableStackShapeOperations<JS::MutableHandle<StackShape>> -{}; - inline Shape::Shape(const StackShape& other, uint32_t nfixed) : base_(other.base), @@ -1550,38 +1541,6 @@ Shape::matches(const StackShape& other) const other.rawGetter, other.rawSetter); } -// Property lookup hooks on objects are required to return a non-nullptr shape -// to signify that the property has been found. For cases where the property is -// not actually represented by a Shape, use a dummy value. This includes all -// properties of non-native objects, and dense elements for native objects. -// Use separate APIs for these two cases. - -template <AllowGC allowGC> -static inline void -MarkNonNativePropertyFound(typename MaybeRooted<Shape*, allowGC>::MutableHandleType propp) -{ - propp.set(reinterpret_cast<Shape*>(1)); -} - -template <AllowGC allowGC> -static inline void -MarkDenseOrTypedArrayElementFound(typename MaybeRooted<Shape*, allowGC>::MutableHandleType propp) -{ - propp.set(reinterpret_cast<Shape*>(1)); -} - -static inline bool -IsImplicitDenseOrTypedArrayElement(Shape* prop) -{ - return prop == reinterpret_cast<Shape*>(1); -} - -static inline bool -IsImplicitNonNativeProperty(Shape* prop) -{ - return prop == reinterpret_cast<Shape*>(1); -} - Shape* ReshapeForAllocKind(JSContext* cx, Shape* shape, TaggedProto proto, gc::AllocKind allocKind); |