Last Comment Bug 738075 - Remove JSFunction::u::n::clasp
: Remove JSFunction::u::n::clasp
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- minor (vote)
: mozilla14
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-21 16:40 PDT by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2012-03-27 05:27 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (17.22 KB, patch)
2012-03-21 16:40 PDT, Jeff Walden [:Waldo] (remove +bmo to email)
dmandelin: review+
Details | Diff | Splinter Review
Followup: remove the Class* argument to GlobalObject::createConstructor (8.96 KB, patch)
2012-03-21 16:42 PDT, Jeff Walden [:Waldo] (remove +bmo to email)
dmandelin: review+
Details | Diff | Splinter Review

Description Jeff Walden [:Waldo] (remove +bmo to email) 2012-03-21 16:40:30 PDT
Created attachment 608142 [details] [diff] [review]
Patch

The object class pointer in native functions is barely used, save in one JSAPI method (JS_NewObjectForConstructor) and in calling the construct hook on a function proxy.  It doesn't really serve a semantic purpose -- or, to the extent it does, it does so confusingly, because almost nothing actually cares what value's stored there.  It would be better to remove it to reduce complexity.

In the JSAPI method case, we can add the desired class to the method signature pretty easily -- and from js-engine list discussion, this shouldn't be too big a problem:

https://groups.google.com/forum/?fromgroups#!topic/mozilla.dev.tech.js-engine/kUEuKi5dVQY

In the proxy case, there are two considerations.  First, under the old proxy proposal, I think we actually were supposed to be passing |undefined| as |this| in that case; that we weren't doing this was just a bug.  Second, it's the *old* proxy proposal.  At some point we'll implement the new one, so what we do to our implementation of the old proposal doesn't much matter.

Anyway.  Less complexity is good.  Let's kill some.
Comment 1 Jeff Walden [:Waldo] (remove +bmo to email) 2012-03-21 16:42:12 PDT
Created attachment 608143 [details] [diff] [review]
Followup: remove the Class* argument to GlobalObject::createConstructor

As a followup, once the class field's removed, we can remove an argument from the method that creates the built-in constructor functions.
Comment 2 David Mandelin [:dmandelin] 2012-03-22 15:59:42 PDT
Comment on attachment 608142 [details] [diff] [review]
Patch

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

js_CreateThis does look better this way.

Note You need to log in before you can comment on or make changes to this bug.