Clarify the purpose of JSClass#66
Clarify the purpose of JSClass#66gschwind wants to merge 1 commit intomozilla-spidermonkey:esr102from
Conversation
The current document does not explain the usage of JSClass clearly. This patch try to give more detail about the purpose of JSClass, how to use it, and it's internal constraint.
ptomato
left a comment
There was a problem hiding this comment.
Very neat, I was not aware that you can actually create a JS class in C++ where the instances and the prototype don't share the same JSClass and JSClassOps! I always thought it was a peculiarity of JSClass that the instances and prototype had to have the same one.
If this is correct, I think it means we can simplify a bunch of other code. For example, we should make the same change in examples/resolve.cpp and that means we can remove the isPrototype() checks from the JSClassOps callbacks.
It used to be that builtin prototype objects in JS had the same type as the instance (e.g.
|
|
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1808171 to improve |
These changes have now landed, so with the next ESR release we can improve this more. |
The current document does not explain the usage of JSClass clearly. This patch try to give more detail about the purpose of JSClass, how to use it, and it's internal constraint.
Note that I did this documentation based on my own investigation within the current spidermonkey code, thus I maybe wrong.