Closed Bug 812392 Opened 13 years ago Closed 13 years ago

Non-leaf DOM prototypes seem to never have pure DOM object types for purposes of type inference

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

For example, Node.prototype is the proto of Element.prototype. So when we create Element.prototype we end up flagging the type for "things whose proto is Node.prototype" as "has non-DOM object". Talked to bhackett about this, and we have a plan that goes like so: 1) Fix JS_NewObjectWithUniqueType to create the object with a null proto, then flag the type as a singleton and only then splice in the right prototype. 2) Fix JSObject::splicePrototype to not call getNewType() on the proto. 3) Make sure all XPConnect prototypes are created with JS_NewObjectWithUniqueType. Patch coming up that does these and seems to work over here to get us running on the Ion fast path for Node stuff.
Comment on attachment 682286 [details] [diff] [review] Make sure we don't allow descendant protoss to confuse whether a proto corresponds to a DOM type. Review of attachment 682286 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsfriendapi.cpp @@ +120,3 @@ > if (!obj || !JSObject::setSingletonType(cx, obj)) > return NULL; > + if (!JS_SplicePrototype(cx, obj, proto)) This (or the NULL above) should get a short comment describing the purpose of this workaround.
Attachment #682286 - Flags: review?(bhackett1024) → review+
/* * Create our object with a null proto and then splice in the correct proto * after we setSingletonType, so that we don't pollute the default * TypeObject attached to our proto with information about our object, since * we're not going to be using that TypeObject anyway. */ Look reasonable?
Attachment #682286 - Flags: review?(peterv) → review+
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla20
Sorry, something in your push turned the mochitests orange. I had to back the entire thing out. https://hg.mozilla.org/integration/mozilla-inbound/rev/461a2225b7ba
Target Milestone: mozilla20 → ---
Attachment #684299 - Flags: review?(bhackett1024)
Attachment #684299 - Flags: review?(bhackett1024) → review+
This patch replaces the previous one. I'm fine with either one, waldo preferred this one. Let me know what you think. All the other callers of this method already pass exactly the proto they want and don't rely on null == Object.prototype, as far as I can tell.
Attachment #684308 - Flags: review?(bhackett1024)
Comment on attachment 684308 [details] [diff] [review] Alternate additional patch to fix orange Yeah, avoiding the kooky null-means-object.prototype behavior in JS_NewObject* and handling things in the API caller would be good.
Attachment #684308 - Flags: review?(bhackett1024) → review+
Target Milestone: --- → mozilla20
Attachment #684308 - Attachment is patch: true
Status: NEW → RESOLVED
Closed: 13 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: