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)
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
2.93 KB,
patch
|
peterv
:
review+
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
979 bytes,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
895 bytes,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
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.
![]() |
Assignee | |
Comment 1•13 years ago
|
||
Attachment #682286 -
Flags: review?(peterv)
Attachment #682286 -
Flags: review?(bhackett1024)
Comment 2•13 years ago
|
||
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+
![]() |
Assignee | |
Comment 3•13 years ago
|
||
/*
* 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?
Comment 4•13 years ago
|
||
Sure
Updated•13 years ago
|
Attachment #682286 -
Flags: review?(peterv) → review+
![]() |
Assignee | |
Comment 5•13 years ago
|
||
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla20
Comment 6•13 years ago
|
||
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 → ---
![]() |
Assignee | |
Comment 7•13 years ago
|
||
Attachment #684299 -
Flags: review?(bhackett1024)
Updated•13 years ago
|
Attachment #684299 -
Flags: review?(bhackett1024) → review+
![]() |
Assignee | |
Comment 8•13 years ago
|
||
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 9•13 years ago
|
||
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+
![]() |
Assignee | |
Comment 10•13 years ago
|
||
With the orange fix:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8e49499b2e9c
Target Milestone: --- → mozilla20
Updated•13 years ago
|
Attachment #684308 -
Attachment is patch: true
Comment 11•13 years ago
|
||
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.
Description
•