Open Bug 760095 Opened 12 years ago Updated 2 years ago

Move canonical standard class objects from slots on the global to members of the Realm

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [js:p2])

Right now user code that wants to add a slot to both globals and non-globals has to use different slot indices, so has to branch every time it wants to use the slot. This is at least biting Paris bindings. Jason suggested that globals should work like functions: some small number of slots at the front are reserved for API consumers, then come the slots the engine uses on globals, and if you want more than the pre-reserved number of slots, they go after the engine slots. In fact, XPConnect is already depending on the fact that the JS engine never uses slot 0 on globals (because it's the original constructor slot for the "Null" class). Doing this would, of course, require hunting down all the places in the engine where we touch the global's slots and adding this compile-time offset to them all... But past that, there should be no slowdown; just a slight bit more memory usage per global.
Blocks: 761695
Once the change underlying bug 755186 is fixed, I think we can just make globals not need pre-reserved global slots, in which case global classes could just use the normal JSCLASS_HAS_RESERVED_SLOTS(n) mechanism.
Whiteboard: [js:p2]
Blocks: 773488
No longer blocks: 761695
No longer blocks: 795343
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
Summary: Globals should pre-reserve some user slots at the start, like functions do → Move canonical standard class objects from slots on the global to members of the compartment
New summary is what I think Jeff and I decided we should do.
Depends on: 923836
No longer blocks: 789261, 890684
Assignee: general → nobody
Summary: Move canonical standard class objects from slots on the global to members of the compartment → Move canonical standard class objects from slots on the global to members of the Realm
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.