⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 254597 in webkit


Ignore:
Timestamp:
Jan 15, 2020, 11:15:05 AM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r254188. rdar://problem/58553146

AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
​https://bugs.webkit.org/show_bug.cgi?id=205906
<rdar://problem/56108519>

Reviewed by Yusuke Suzuki.

JSTests:

  • stress/ai-value-div-should-result-in-constant-int-where-possible.js: Added. (foo.bar.f): (foo.): (foo):
  • stress/ai-value-mod-should-result-in-constant-int-where-possible.js: Added. (foo.bar.f): (foo.): (foo):

Source/JavaScriptCore:

The runtime code for ValueMod and ValueDiv produces an int32 when the result
is of int32 value. However, the AI was saying the result is in double format.
This patch fixes AI to produce a JSValue in the right format.

  • dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::handleConstantDivOp):

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@254188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-609-branch
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-609-branch/JSTests/ChangeLog

    r254477 r254597  
     12020-01-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r254188. rdar://problem/58553146
     4
     5    AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     6    https://bugs.webkit.org/show_bug.cgi?id=205906
     7    <rdar://problem/56108519>
     8   
     9    Reviewed by Yusuke Suzuki.
     10   
     11    JSTests:
     12   
     13    * stress/ai-value-div-should-result-in-constant-int-where-possible.js: Added.
     14    (foo.bar.f):
     15    (foo.):
     16    (foo):
     17    * stress/ai-value-mod-should-result-in-constant-int-where-possible.js: Added.
     18    (foo.bar.f):
     19    (foo.):
     20    (foo):
     21   
     22    Source/JavaScriptCore:
     23   
     24    The runtime code for ValueMod and ValueDiv produces an int32 when the result
     25    is of int32 value. However, the AI was saying the result is in double format.
     26    This patch fixes AI to produce a JSValue in the right format.
     27   
     28    * dfg/DFGAbstractInterpreterInlines.h:
     29    (JSC::DFG::AbstractInterpreter<AbstractStateType>::handleConstantDivOp):
     30   
     31   
     32    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     33
     34    2020-01-07  Saam Barati  <sbarati@apple.com>
     35
     36            AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     37            https://bugs.webkit.org/show_bug.cgi?id=205906
     38            <rdar://problem/56108519>
     39
     40            Reviewed by Yusuke Suzuki.
     41
     42            * stress/ai-value-div-should-result-in-constant-int-where-possible.js: Added.
     43            (foo.bar.f):
     44            (foo.):
     45            (foo):
     46            * stress/ai-value-mod-should-result-in-constant-int-where-possible.js: Added.
     47            (foo.bar.f):
     48            (foo.):
     49            (foo):
     50
    1512020-01-13  Alan Coon  <alancoon@apple.com>
    252
  • branches/safari-609-branch/Source/JavaScriptCore/ChangeLog

    r254593 r254597  
     12020-01-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r254188. rdar://problem/58553146
     4
     5    AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     6    https://bugs.webkit.org/show_bug.cgi?id=205906
     7    <rdar://problem/56108519>
     8   
     9    Reviewed by Yusuke Suzuki.
     10   
     11    JSTests:
     12   
     13    * stress/ai-value-div-should-result-in-constant-int-where-possible.js: Added.
     14    (foo.bar.f):
     15    (foo.):
     16    (foo):
     17    * stress/ai-value-mod-should-result-in-constant-int-where-possible.js: Added.
     18    (foo.bar.f):
     19    (foo.):
     20    (foo):
     21   
     22    Source/JavaScriptCore:
     23   
     24    The runtime code for ValueMod and ValueDiv produces an int32 when the result
     25    is of int32 value. However, the AI was saying the result is in double format.
     26    This patch fixes AI to produce a JSValue in the right format.
     27   
     28    * dfg/DFGAbstractInterpreterInlines.h:
     29    (JSC::DFG::AbstractInterpreter<AbstractStateType>::handleConstantDivOp):
     30   
     31   
     32    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     33
     34    2020-01-07  Saam Barati  <sbarati@apple.com>
     35
     36            AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     37            https://bugs.webkit.org/show_bug.cgi?id=205906
     38            <rdar://problem/56108519>
     39
     40            Reviewed by Yusuke Suzuki.
     41
     42            The runtime code for ValueMod and ValueDiv produces an int32 when the result
     43            is of int32 value. However, the AI was saying the result is in double format.
     44            This patch fixes AI to produce a JSValue in the right format.
     45
     46            * dfg/DFGAbstractInterpreterInlines.h:
     47            (JSC::DFG::AbstractInterpreter<AbstractStateType>::handleConstantDivOp):
     48
    1492020-01-14  Alan Coon  <alancoon@apple.com>
    250
  • branches/safari-609-branch/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r253991 r254597  
    324324                didFoldClobberWorld();
    325325
    326             if (isDivOperation)
    327                 setConstant(node, jsDoubleNumber(left.asNumber() / right.asNumber()));
    328             else
    329                 setConstant(node, jsDoubleNumber(fmod(left.asNumber(), right.asNumber())));
     326            if (isDivOperation) {
     327                if (op == ValueDiv)
     328                    setConstant(node, jsNumber(left.asNumber() / right.asNumber()));
     329                else
     330                    setConstant(node, jsDoubleNumber(left.asNumber() / right.asNumber()));
     331            } else {
     332                if (op == ValueMod)
     333                    setConstant(node, jsNumber(fmod(left.asNumber(), right.asNumber())));
     334                else
     335                    setConstant(node, jsDoubleNumber(fmod(left.asNumber(), right.asNumber())));
     336            }
    330337
    331338            return true;
Note: See TracChangeset for help on using the changeset viewer.