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

Changeset 254188 in webkit


Ignore:
Timestamp:
Jan 7, 2020, 11:23:30 PM (7 years ago)
Author:
sbarati@apple.com
Message:

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):

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r254088 r254188  
     12020-01-07  Saam Barati  <sbarati@apple.com>
     2
     3        AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     4        https://bugs.webkit.org/show_bug.cgi?id=205906
     5        <rdar://problem/56108519>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        * stress/ai-value-div-should-result-in-constant-int-where-possible.js: Added.
     10        (foo.bar.f):
     11        (foo.):
     12        (foo):
     13        * stress/ai-value-mod-should-result-in-constant-int-where-possible.js: Added.
     14        (foo.bar.f):
     15        (foo.):
     16        (foo):
     17
    1182020-01-06  Alexey Shvayka  <shvaikalesh@gmail.com>
    219
  • trunk/Source/JavaScriptCore/ChangeLog

    r254187 r254188  
     12020-01-07  Saam Barati  <sbarati@apple.com>
     2
     3        AI rule for ValueMod/ValueDiv produce constants with the wrong format when the result can be an int32
     4        https://bugs.webkit.org/show_bug.cgi?id=205906
     5        <rdar://problem/56108519>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        The runtime code for ValueMod and ValueDiv produces an int32 when the result
     10        is of int32 value. However, the AI was saying the result is in double format.
     11        This patch fixes AI to produce a JSValue in the right format.
     12
     13        * dfg/DFGAbstractInterpreterInlines.h:
     14        (JSC::DFG::AbstractInterpreter<AbstractStateType>::handleConstantDivOp):
     15
    1162020-01-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
    217
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r254087 r254188  
    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.