Closed Bug 810373 Opened 12 years ago Closed 12 years ago

BaselineCompiler: Add WeakMap-per-runtime of baseline stubCode and enable their sharing between different ICs.

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: djvj, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

      No description provided.
Needed to add a new type WeakValueMap that doesn't try to treat its keys as gcthings, since we're using int32 keys.
Attachment #680329 - Flags: review?(jdemooij)
Comment on attachment 680329 [details] [diff] [review]
Add weakmap to IonCompartment to share baseline IC stub codes.

Review of attachment 680329 [details] [diff] [review]:
-----------------------------------------------------------------

Nice.

::: js/src/jsweakcache.h
@@ +86,5 @@
> +    explicit WeakValueCache(JSContext *cx) : Base(cx) { }
> +
> +  public:
> +    // Sweep all entries which have unmarked key or value.
> +    void sweep(FreeOp *fop) {

We should call this method in IonCompartment::sweep.

For now we can mark all values in the table in IonCompartment::mark, but if we want it to behave like a real WeakMap we have to iterate over all stubs, find out which IonCode belongs to it and mark that. Do we have to store an IonCode pointer in the stub for that?

@@ +91,5 @@
> +        // Remove all entries whose values remain unmarked.
> +        for (Enum e(*this); !e.empty(); e.popFront()) {
> +            if (!gc::IsMarked(e.front().value)) {
> +                e.removeFront();
> +            }

Nit: no braces

@@ +99,5 @@
> +        // Once we've swept, all remaining edges should stay within the
> +        // known-live part of the graph.
> +        for (Range r = Base::all(); !r.empty(); r.popFront()) {
> +            JS_ASSERT(gc::IsMarked(r.front().value));
> +        }

Same here.
Attachment #680329 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/projects/ionmonkey/rev/ba510446fef6
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: