Bug 122802 - Don't generate a wasteful isObservable check in isReachableFromOpaqueRoots
Summary: Don't generate a wasteful isObservable check in isReachableFromOpaqueRoots
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-14 18:09 PDT by Alexey Proskuryakov
Modified: 2013-10-14 19:46 PDT (History)
10 users (show)

See Also:


Attachments
proposed patch (14.76 KB, patch)
2013-10-14 18:16 PDT, Alexey Proskuryakov
mhahnenberg: review+
Details | Formatted Diff | Diff
a little better (15.15 KB, patch)
2013-10-14 18:22 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2013-10-14 18:09:31 PDT
Like here:

bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSTestObj* jsTestObj = jsCast<JSTestObj*>(handle.get().asCell());
    if (!isObservable(jsTestObj))
        return false;
    UNUSED_PARAM(visitor);
    return false;
}
Comment 1 Alexey Proskuryakov 2013-10-14 18:16:08 PDT
Created attachment 214214 [details]
proposed patch

The added UNUSED_PARAM is not always accurate, but neither was an existing one.
Comment 2 Mark Hahnenberg 2013-10-14 18:18:59 PDT
Comment on attachment 214214 [details]
proposed patch

r=me
Comment 3 Alexey Proskuryakov 2013-10-14 18:22:00 PDT
Created attachment 214215 [details]
a little better

Actually, can do a little better.
Comment 4 Mark Hahnenberg 2013-10-14 18:28:07 PDT
Comment on attachment 214215 [details]
a little better

View in context: https://bugs.webkit.org/attachment.cgi?id=214215&action=review

r=me

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2575
> +            push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.get().asCell());\n");
> +            $emittedJSCast = 1;

Might want to check if (!$emittedJSCast) for future people to pick up on the pattern if they add something. Up to you though.
Comment 5 Alexey Proskuryakov 2013-10-14 19:22:15 PDT
Comment on attachment 214215 [details]
a little better

View in context: https://bugs.webkit.org/attachment.cgi?id=214215&action=review

>> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2575
>> +            $emittedJSCast = 1;
> 
> Might want to check if (!$emittedJSCast) for future people to pick up on the pattern if they add something. Up to you though.

Yeah, I also had this thought cross my mind... I think that adding an unnecessary check would be confusing, and that does not overweigh the benefit of easier copy/pasting.
Comment 6 WebKit Commit Bot 2013-10-14 19:46:04 PDT
Comment on attachment 214215 [details]
a little better

Clearing flags on attachment: 214215

Committed r157438: <http://trac.webkit.org/changeset/157438>
Comment 7 WebKit Commit Bot 2013-10-14 19:46:07 PDT
All reviewed patches have been landed.  Closing bug.