Closed Bug 788199 Opened 12 years ago Closed 3 years ago

SpiderMonkey: Clarify and clean up getter/setterObject() vs. getter/setterValue() on shapes.

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1700052

People

(Reporter: djvj, Unassigned)

Details

(Whiteboard: [js:t])

No-one really seems to know how why this is supposed to work. The following is describe for getters only but it also applies to setters. The Issue: BaseShape::hasGetterObject() [checks BaseShape::flags & HAS_GETTER_OBJECT] Shape::hasGetterValue() [checks Shape::attrs & JSPROP_GETTER] Shape::getterObject() - Asserts Shape::hasGetterValue(), returns base()->getterObj directly Shape::getterValue() - Asserts Shape::hasGetterValue(), returns base->getterObj wrapping it in a Value, returning UndefinedValue if base()->getterObj is NULL. BaseShape::getterObject() - Asserts BaseShape::hasGetterObject, returns getterObj. The Questions: What's the purpose of hasGetterObject? Can shape->attr & JSPROP_GETTER ever be true at the same time shape->base()->flags & HAS_GETTER_OBJECT is false? Why do the getterObject() methods on Shape vs. BaseShape check completely different conditions but return the same pointer? Is one of these flags redundant?
A quick search on Aurora seems to indicate that the only uses of getterObject on BaseShape is from GC code, which does |hasGetterObject()| on baseShape, and then uses |getterObj| without any NULL checks. Also, the only places baseShape->flags |= HAS_GETTER_OBJECT gets set is in jsscopeinlines.h, when the shape->attrs & JSPROP_GETTER is true, and the raw getter is not null. The only user of hasGetterObject on baseShape is the GC. All this leads to the conclusion that HAS_GETTER_OBJECT/hasGetterObject is effectively an elaborate null check.
Whiteboard: [js:t]
Assignee: general → nobody

Fixed through bug 1700052.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.