Closed Bug 604813 Opened 14 years ago Closed 10 years ago

Eliminate cx->globalObject

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 981218
Tracking Status
status2.0 --- wanted

People

(Reporter: gal, Assigned: gal)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This patch eliminates cx->globalObject and makes JSAutoRequest take a scope object (usually a global object), which becomes the default global and we also switch to that scope object's compartment.

This modifies the signature of JS_BeginRequest, and eliminates JS_Set/GetGlobalObject.

Shell starts up.
Attached patch patchSplinter Review
Assignee: general → gal
Hooray!
(In reply to comment #0)
> This modifies the signature of JS_BeginRequest, and eliminates
> JS_Set/GetGlobalObject.

The changes will be hard to swallow for embeddings that uses JS_BeginRequest as they now will need to check for the return result of JS_BeginRequest.

Another observation is that this introduces a stack of requests. IIRC few places in Firefox code still violates that with code like BeginRequest(cx1) BeginRequest(cx2) EndRequest(cx1) EndRequest(cx2)

So perhaps as an alternative to changes here what about simply patching API that leads to the need to access the global object with an explicit global scope  parameter? For example, if the callers of js_GetClassPrototype would be patched to ensure that they always pass non-null global object, it would eliminate most if not all needs for ::globalObject.
Yeah, I have been playing around with several approaches. The fix for #2 is to delete that code. We can't be bogged down by horrible API abuses in Firefox code. That code has to die. Fortunately, I have only seen a handful of uses of Begin/End request. Most of Gecko uses JSAutoRequest already.
blocking2.0: --- → beta8+
blocking2.0: beta8+ → beta9+
No longer have to block on this. We will force all threads to synchronize even if we only GC a single compartment.
blocking2.0: beta9+ → ---
status2.0: --- → wanted
Blocks: 616927
No longer blocks: compartmentGC
Depends on: 625199
Depends on: 650361
Blocks: 650361
No longer depends on: 650361
Depends on: 868110
Depends on: 767938
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.

Attachment

General

Created:
Updated:
Size: