RESOLVED FIXED 107163
Objective-C API: Clean up JSValue.mm
https://bugs.webkit.org/show_bug.cgi?id=107163
Summary Objective-C API: Clean up JSValue.mm
Mark Hahnenberg
Reported 2013-01-17 13:01:31 PST
m_context is no longer weak, so there is now a lot of dead code in in JSValue.mm, and a wasted message send on every API call. In the head of just about every method in JSValue.mm we're doing: JSContext *context = [self context]; if (!context) return nil; This is getting a retained copy of the context, which is no longer necessary now m_context is no longer weak. We can just delete all these lines from all functions doing this, and where they were referring to the local variable 'context', instead we can just access m_context directly.
Attachments
Patch (22.42 KB, patch)
2013-01-17 13:14 PST, Mark Hahnenberg
no flags
Patch (24.42 KB, patch)
2013-01-17 13:29 PST, Mark Hahnenberg
no flags
Mark Hahnenberg
Comment 1 2013-01-17 13:12:18 PST
Mark Hahnenberg
Comment 2 2013-01-17 13:14:27 PST
Mark Hahnenberg
Comment 3 2013-01-17 13:16:47 PST
Comment on attachment 183254 [details] Patch Need to make some modifications.
Mark Hahnenberg
Comment 4 2013-01-17 13:25:18 PST
Since we're already going to be modifying most of JSValue.mm, we'll also do the following: (1) context @property is no longer weak – the context property is declared as: @property(readonly, weak) JSContext *context; This is really only informative (since we're not presently synthesizing the ivar), but it is now misleading. We should change it to: @property(readonly, retain) JSContext *context; (2) the JSContext ivar and accessor can be automatically generated. Since we're no longer doing anything special with m_context, we can just let the compiler handle the ivar for us. We'll delete: JSContext *m_context; and: - (JSContext *)context { return m_context; } and find&replace "m_context" to "_context" in JSValue.mm.
Mark Hahnenberg
Comment 5 2013-01-17 13:29:33 PST
Filip Pizlo
Comment 6 2013-01-17 13:32:35 PST
Comment on attachment 183259 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=183259&action=review > Source/JavaScriptCore/ChangeLog:8 > + m_context is no longer weak, so there is now a lot of dead code in in JSValue.mm, and a wasted message send in in
WebKit Review Bot
Comment 7 2013-01-17 18:35:11 PST
Comment on attachment 183259 [details] Patch Clearing flags on attachment: 183259 Committed r140086: <http://trac.webkit.org/changeset/140086>
WebKit Review Bot
Comment 8 2013-01-17 18:35:14 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.