Changeset 253144 in webkit


Ignore:
Timestamp:
Dec 4, 2019 10:26:06 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] AI should convert IsCellWithType to constant when Structure set is finite
https://bugs.webkit.org/show_bug.cgi?id=204141

Reviewed by Mark Lam.

JSTests:

  • stress/generator-cell-with-type.js: Added.

(shouldBe):
(shouldThrow):
(test):
(i.shouldThrow):

  • stress/is-cell-with-type-should-check-non-cell-cases.js: Added.

(getter):
(foo):

Source/JavaScriptCore:

We should fold IsCellWithType if Structure set is finite since we have a chance to know what JSType is.
The difference from the last patch is that we have if (!(child.m_type & ~SpecCell)) check. Even if
structures meet the requirement, this structures do not guarantee that non cell types never come. We
should ensure it by using proven type.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r253137 r253144  
     12019-12-04  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] AI should convert IsCellWithType to constant when Structure set is finite
     4        https://bugs.webkit.org/show_bug.cgi?id=204141
     5
     6        Reviewed by Mark Lam.
     7
     8        * stress/generator-cell-with-type.js: Added.
     9        (shouldBe):
     10        (shouldThrow):
     11        (test):
     12        (i.shouldThrow):
     13        * stress/is-cell-with-type-should-check-non-cell-cases.js: Added.
     14        (getter):
     15        (foo):
     16
    1172019-12-04  Mark Lam  <mark.lam@apple.com>
    218
  • trunk/Source/JavaScriptCore/ChangeLog

    r253143 r253144  
     12019-12-04  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] AI should convert IsCellWithType to constant when Structure set is finite
     4        https://bugs.webkit.org/show_bug.cgi?id=204141
     5
     6        Reviewed by Mark Lam.
     7
     8        We should fold IsCellWithType if Structure set is finite since we have a chance to know what JSType is.
     9        The difference from the last patch is that we have `if (!(child.m_type & ~SpecCell))` check. Even if
     10        structures meet the requirement, this structures do not guarantee that non cell types never come. We
     11        should ensure it by using proven type.
     12
     13        * dfg/DFGAbstractInterpreterInlines.h:
     14        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
     15
    1162019-12-04  Yusuke Suzuki  <ysuzuki@apple.com>
    217
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r253124 r253144  
    14441444            if (constantWasSet)
    14451445                break;
     1446        }
     1447
     1448        if (!(child.m_type & ~SpecCell)) {
     1449            if (child.m_structure.isFinite()) {
     1450                bool constantWasSet = false;
     1451                switch (node->op()) {
     1452                case IsCellWithType: {
     1453                    bool ok = true;
     1454                    Optional<bool> result;
     1455                    child.m_structure.forEach(
     1456                        [&](RegisteredStructure structure) {
     1457                            bool matched = structure->typeInfo().type() == node->queriedType();
     1458                            if (!result)
     1459                                result = matched;
     1460                            else {
     1461                                if (result.value() != matched)
     1462                                    ok = false;
     1463                            }
     1464                        });
     1465                    if (ok && result) {
     1466                        setConstant(node, jsBoolean(result.value()));
     1467                        constantWasSet = true;
     1468                    }
     1469                    break;
     1470                }
     1471                default:
     1472                    break;
     1473                }
     1474                if (constantWasSet)
     1475                    break;
     1476            }
    14461477        }
    14471478       
Note: See TracChangeset for help on using the changeset viewer.