Closed
Bug 773488
Opened 12 years ago
Closed 10 years ago
remove 'parent' from JSAPI
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 805052
People
(Reporter: luke, Unassigned)
References
(Depends on 1 open bug)
Details
(Whiteboard: [js:t])
With CPG, the primary use of 'parent' is gone. The only secondary use I'm aware of is that DOM nodes use 'parent' to embed the DOM's parent chain. Initially, I thought these could be reserved slots on the object, however this 'parent' link also needs to be used as the 'enclosing scope' link. I think the solution is to just extend what we do for lexical scopes to JSAPI clients by adding a JSCLASS_HAS_ENCLOSING_SCOPE bit which says that reserved slot 0 is to be treated as the enclosing scope.
Anything I'm missing Boris/Bobby?
With this bug, we can completely remove the concept of 'parent' from the engine which should save memory on BaseShapes and remove a good bit of hairy code.
Comment 1•12 years ago
|
||
Well, Bobby just made me write code that depended on JS_GetParent.... ;)
Other than that, I don't think you're missing anything, assuming we have free JSClass flags. Oh, and actually using slot 0 won't work because slot 0 is being used for the DOM binding native object pointer. But we could use slot 1.....
Comment 2•12 years ago
|
||
Yeah, that sounds ok. Historically the DOM and XPConnect have depended on the parent chain as a "useful way to find something often-used", since they had to set it anyway (this is why I asked bz to set up the SandboxProxy stuff that way). But that stuff can definitely be done with reserved slots. And yes, functions will need some way to indicate that their parent is actually their enclosing scope.
IMO, bug 760095 should block this one, otherwise using all these reserved slots correctly becomes a huge PITA.
Depends on: 760095
Updated•12 years ago
|
Whiteboard: [js:t]
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Reporter | ||
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•