Changeset 252416 in webkit


Ignore:
Timestamp:
Nov 13, 2019 10:45:52 AM (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 Saam Barati.

JSTests:

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

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

Source/JavaScriptCore:

We should fold IsCellWithType if Structure set is finite since we have a chance to know what JSType is.

  • dfg/DFGAbstractInterpreterInlines.h:

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

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r252385 r252416  
     12019-11-13  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 Saam Barati.
     7
     8        * stress/generator-cell-with-type.js: Added.
     9        (shouldBe):
     10        (shouldThrow):
     11        (test):
     12        (i.shouldThrow):
     13
    1142019-11-12  Yusuke Suzuki  <ysuzuki@apple.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r252390 r252416  
     12019-11-13  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 Saam Barati.
     7
     8        We should fold IsCellWithType if Structure set is finite since we have a chance to know what JSType is.
     9
     10        * dfg/DFGAbstractInterpreterInlines.h:
     11        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
     12
    1132019-11-12  Yusuke Suzuki  <ysuzuki@apple.com>
    214
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

    r252374 r252416  
    14151415            default:
    14161416                constantWasSet = false;
     1417                break;
     1418            }
     1419            if (constantWasSet)
     1420                break;
     1421        }
     1422
     1423        if (forNode(node->child1()).m_structure.isFinite()) {
     1424            bool constantWasSet = false;
     1425            switch (node->op()) {
     1426            case IsCellWithType: {
     1427                bool ok = true;
     1428                Optional<bool> result;
     1429                forNode(node->child1()).m_structure.forEach(
     1430                    [&](RegisteredStructure structure) {
     1431                        bool matched = structure->typeInfo().type() == node->queriedType();
     1432                        if (!result)
     1433                            result = matched;
     1434                        else {
     1435                            if (result.value() != matched)
     1436                                ok = false;
     1437                        }
     1438                    });
     1439                if (ok && result) {
     1440                    setConstant(node, jsBoolean(result.value()));
     1441                    constantWasSet = true;
     1442                }
     1443                break;
     1444            }
     1445            default:
    14171446                break;
    14181447            }
Note: See TracChangeset for help on using the changeset viewer.