Bug 122263 - DFG: ConstProp the pattern ValueToInt32(Bool(x)) -> Int32(x)
Summary: DFG: ConstProp the pattern ValueToInt32(Bool(x)) -> Int32(x)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-03 00:26 PDT by Nadav Rotem
Modified: 2013-10-03 07:53 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.98 KB, patch)
2013-10-03 00:26 PDT, Nadav Rotem
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nadav Rotem 2013-10-03 00:26:00 PDT
DFG: ConstProp the pattern ValueToInt32(Bool(x)) -> Int32(x)
Comment 1 Nadav Rotem 2013-10-03 00:26:43 PDT
Created attachment 213234 [details]
Patch
Comment 2 Geoffrey Garen 2013-10-03 00:43:09 PDT
Comment on attachment 213234 [details]
Patch

r=me
Comment 3 WebKit Commit Bot 2013-10-03 01:41:48 PDT
Comment on attachment 213234 [details]
Patch

Clearing flags on attachment: 213234

Committed r156830: <http://trac.webkit.org/changeset/156830>
Comment 4 WebKit Commit Bot 2013-10-03 01:41:50 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Filip Pizlo 2013-10-03 07:48:58 PDT
Comment on attachment 213234 [details]
Patch

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

> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:297
> +                setConstant(node, JSValue(child.asBoolean()));

Is the goal here to convert the Boolean to a number?  If so, does JSValue(bool) accomplish this?  My guesses that if it does, it's sort of by luck and we'd want to call jsNumber() directly.
Comment 6 Filip Pizlo 2013-10-03 07:53:24 PDT
Comment on attachment 213234 [details]
Patch

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

>> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:297
>> +                setConstant(node, JSValue(child.asBoolean()));
> 
> Is the goal here to convert the Boolean to a number?  If so, does JSValue(bool) accomplish this?  My guesses that if it does, it's sort of by luck and we'd want to call jsNumber() directly.

Ugh, yeah we don't have a JSValue(bool) overload. So this works - but I think it would be better to use jsNumber() here and in the case above. We've been considering getting rid of the JSValue(number) overloads because you can get quite confused in corner cases.