Closed Bug 1370614 Opened 7 years ago Closed 7 years ago

Replace some uses of ProtoAndIfaceCache::EntrySlotIfExists with something that returns a boolean

Categories

(Core :: DOM: Core & HTML, enhancement)

53 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Right now we return a JSObject*, which means we end up barriering on it and doing exposeToJS.  There's no need to do that; all the consumers just want to know whether it's null.  So we could return a boolean, which Heap<JSObject*> can produce without barriering.
Depends on: 1364816
Summary: Replace ProtoAndIfaceCache::EntrySlotIfExists with something that returns a boolean → Replace some uses of ProtoAndIfaceCache::EntrySlotIfExists with something that returns a boolean
Comment on attachment 8874953 [details] [diff] [review]
Replace some uses of ProtoAndIfaceCache::EntrySlotIfExists with a faster boolean-returning test function

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

::: dom/bindings/BindingUtils.h
@@ +319,5 @@
>        }
>        return (*p)[leafIndex];
>      }
>  
> +    bool HasEntryInSlot(size_t i) {

Would be nice if there was a way to write this function without so much duplication, but... :(
Attachment #8874953 - Flags: review?(nfroyd) → review+
Yeah, I couldn't figure out a way to do that, without doing manual exposing stuff or something.  I thought I could nix EntrySlotIfExists completely, but we do have one single consumer of it that actually wants the JSObject*.

That said, maybe I can just switch ResolvePrototypeOrConstructor to EntrySlotMustExist. I believe in all cases when it's used this is in fact true...  and the current behavior when null is returned is a bit bonkers anyway (uncatchable exception).  Filed bug 1370640.
Blocks: 1370640
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b84707ac2dfe
Replace some uses of ProtoAndIfaceCache::EntrySlotIfExists with a faster boolean-returning test function.  r=froydnj
https://hg.mozilla.org/mozilla-central/rev/b84707ac2dfe
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: