Create a way to attach DOM-related metadata to JS getters and setters

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bz, Assigned: efaust)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

See bug 747285.  This is step (A).
Blocks: 747287
(Assignee)

Comment 1

5 years ago
The easiest way to do this seems to be to teach TI about the DOM subtyping relations. It shouldn't be too hard to extend the TypeObjects in an opt-in way to include an array similar to |mInterfaceChain| in DOMJSClass, and then just copy that information in from the prototype as we create them in JS_NewObject() adding the DOM type of the instance to the new TypeObject as well.

The hard part is the properties themselves. We need TI to know what prototypes the DOM property getters are supposed to be attached to, so that we cannot create a property with the appropriate name and signature on the wrong DOM class and have the C++ gladly do something totally wrong.

This we can probably store in the Property object hanging off the TypeObject, which we can look into in typeObj->addProperty().
(Assignee)

Updated

5 years ago
Assignee: general → efaust
Status: NEW → ASSIGNED
(Assignee)

Comment 2

5 years ago
Having done some more discussion, it seems wiser to proceed on this matter in the following way:

TI will need to be informed at creation time, similar to the way that typed arrays are handled, if the type object represents DOM objects. Any time something that isn't a DOM object is created, it will unset the flag. This flag will the tell us that it's safe to investigate DOM related optimizations.

The metadata attached to the getters and setters will utilize an unused word in the u.native half of the union to sneak a pointer to a statically created struct of DOM metadata into the JSFunction. This field will be set exactly in the DOM case, and NULL otherwise. This will allow us to get the metadata we need into the engine.
(Assignee)

Updated

5 years ago
Depends on: 766447
(Assignee)

Updated

5 years ago
Depends on: 766448
(Assignee)

Updated

5 years ago
No longer depends on: 766447
(Assignee)

Updated

5 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.