Changeset 249743 in webkit


Ignore:
Timestamp:
Sep 10, 2019 5:17:03 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

Unreviewed, rolling out r249721.
https://bugs.webkit.org/show_bug.cgi?id=201667

Discovering existing bug (Requested by yusukesuzuki on
#webkit).

Reverted changeset:

"[JSC] 32bit bitwide operation with all-one (-1) is wrong in
B3"
https://bugs.webkit.org/show_bug.cgi?id=201634
https://trac.webkit.org/changeset/249721

Patch by Commit Queue <commit-queue@webkit.org> on 2019-09-10

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r249740 r249743  
     12019-09-10  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r249721.
     4        https://bugs.webkit.org/show_bug.cgi?id=201667
     5
     6        Discovering existing bug (Requested by yusukesuzuki on
     7        #webkit).
     8
     9        Reverted changeset:
     10
     11        "[JSC] 32bit bitwide operation with all-one (-1) is wrong in
     12        B3"
     13        https://bugs.webkit.org/show_bug.cgi?id=201634
     14        https://trac.webkit.org/changeset/249721
     15
    1162019-09-10  Yusuke Suzuki  <ysuzuki@apple.com>
    217
  • trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r249721 r249743  
    27502750            }
    27512751
    2752             if (m_value->child(1)->isInt64(0xffffffff) || m_value->child(1)->isInt32(0xffffffff)) {
     2752            if (m_value->child(1)->isInt(0xffffffff)) {
    27532753                appendUnOp<Move32, Move32>(m_value->child(0));
    27542754                return;
  • trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp

    r249721 r249743  
    10341034            // Turn this: BitAnd(value, all-ones)
    10351035            // Into this: value.
    1036             if ((m_value->type() == Int64 && m_value->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
    1037                 || (m_value->type() == Int32 && m_value->child(1)->isInt32(std::numeric_limits<uint32_t>::max()))) {
     1036            if ((m_value->type() == Int64 && m_value->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
     1037                || (m_value->type() == Int32 && m_value->child(1)->isInt(std::numeric_limits<uint32_t>::max()))) {
    10381038                replaceWithIdentity(m_value->child(0));
    10391039                break;
     
    10841084            // into this: BitAnd(value, constant2)
    10851085            if (m_value->child(1)->hasInt()) {
    1086                 bool replaced = false;
    10871086                int64_t constant2 = m_value->child(1)->asInt();
    10881087                switch (m_value->child(0)->opcode()) {
     
    10931092                        m_value->child(0) = m_value->child(0)->child(0);
    10941093                        m_changed = true;
    1095                         replaced = true;
    10961094                        break;
    10971095                    }
     
    11001098                    break;
    11011099                }
    1102                 if (replaced)
    1103                     break;
     1100                break;
    11041101            }
    11051102
     
    11101107                && m_value->child(1)->opcode() == BitXor
    11111108                && ((m_value->type() == Int64
    1112                         && m_value->child(0)->child(1)->isInt64(std::numeric_limits<uint64_t>::max())
    1113                         && m_value->child(1)->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
     1109                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max())
     1110                        && m_value->child(1)->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
    11141111                    || (m_value->type() == Int32
    1115                         && m_value->child(0)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())
    1116                         && m_value->child(1)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())))) {
     1112                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())
     1113                        && m_value->child(1)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) {
    11171114                Value* bitOr = m_insertionSet.insert<Value>(m_index, BitOr, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->child(0));
    11181115                replaceWithNew<Value>(BitXor, m_value->origin(), bitOr, m_value->child(1)->child(1));
     
    11271124                && m_value->child(1)->hasInt()
    11281125                && ((m_value->type() == Int64
    1129                         && m_value->child(0)->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
     1126                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
    11301127                    || (m_value->type() == Int32
    1131                         && m_value->child(0)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())))) {
     1128                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) {
    11321129                Value* bitOr = m_insertionSet.insert<Value>(m_index, BitOr, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->bitXorConstant(m_proc, m_value->child(0)->child(1)));
    11331130                replaceWithNew<Value>(BitXor, m_value->origin(), bitOr, m_value->child(0)->child(1));
     
    11751172            // Turn this: BitOr(value, all-ones)
    11761173            // Into this: all-ones.
    1177             if ((m_value->type() == Int64 && m_value->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
    1178                 || (m_value->type() == Int32 && m_value->child(1)->isInt32(std::numeric_limits<uint32_t>::max()))) {
     1174            if ((m_value->type() == Int64 && m_value->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
     1175                || (m_value->type() == Int32 && m_value->child(1)->isInt(std::numeric_limits<uint32_t>::max()))) {
    11791176                replaceWithIdentity(m_value->child(1));
    11801177                break;
     
    11871184                && m_value->child(1)->opcode() == BitXor
    11881185                && ((m_value->type() == Int64
    1189                         && m_value->child(0)->child(1)->isInt64(std::numeric_limits<uint64_t>::max())
    1190                         && m_value->child(1)->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
     1186                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max())
     1187                        && m_value->child(1)->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
    11911188                    || (m_value->type() == Int32
    1192                         && m_value->child(0)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())
    1193                         && m_value->child(1)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())))) {
     1189                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())
     1190                        && m_value->child(1)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) {
    11941191                Value* bitAnd = m_insertionSet.insert<Value>(m_index, BitAnd, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->child(0));
    11951192                replaceWithNew<Value>(BitXor, m_value->origin(), bitAnd, m_value->child(1)->child(1));
     
    12041201                && m_value->child(1)->hasInt()
    12051202                && ((m_value->type() == Int64
    1206                         && m_value->child(0)->child(1)->isInt64(std::numeric_limits<uint64_t>::max()))
     1203                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max()))
    12071204                    || (m_value->type() == Int32
    1208                         && m_value->child(0)->child(1)->isInt32(std::numeric_limits<uint32_t>::max())))) {
     1205                        && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) {
    12091206                Value* bitAnd = m_insertionSet.insert<Value>(m_index, BitAnd, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->bitXorConstant(m_proc, m_value->child(0)->child(1)));
    12101207                replaceWithNew<Value>(BitXor, m_value->origin(), bitAnd, m_value->child(0)->child(1));
  • trunk/Source/JavaScriptCore/b3/testb3.h

    r249721 r249743  
    460460void testBitXorSameArg(int64_t);
    461461void testBitXorAndAndArgs(int64_t, int64_t, int64_t c);
    462 void testBitXorAndAndArgs32(int32_t, int32_t, int32_t c);
    463462void testBitXorAndSameArgs(int64_t, int64_t);
    464 void testBitXorAndSameArgs32(int32_t, int32_t);
    465463void testBitXorImms(int64_t, int64_t);
    466464void testBitXorArgImm(int64_t, int64_t);
  • trunk/Source/JavaScriptCore/b3/testb3_2.cpp

    r249721 r249743  
    25662566}
    25672567
    2568 static void testBitAndNotNot32(int32_t a, int32_t b)
    2569 {
    2570     Procedure proc;
    2571     BasicBlock* root = proc.addBlock();
    2572     Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    2573     Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    2574     Value* notA = root->appendNew<Value>(proc, BitXor, Origin(), argA, root->appendNew<Const32Value>(proc, Origin(), -1));
    2575     Value* notB = root->appendNew<Value>(proc, BitXor, Origin(), argB, root->appendNew<Const32Value>(proc, Origin(), -1));
    2576     root->appendNewControlValue(
    2577         proc, Return, Origin(),
    2578         root->appendNew<Value>(
    2579             proc, BitAnd, Origin(),
    2580             notA,
    2581             notB));
    2582 
    2583     CHECK_EQ(compileAndRun<int32_t>(proc, a, b), (~a & ~b));
    2584 }
    2585 
    25862568static void testBitAndNotImm(int64_t a, int64_t b)
    25872569{
     
    25982580            cstB));
    25992581
    2600     CHECK_EQ(compileAndRun<int64_t>(proc, a), (~a & b));
    2601 }
    2602 
    2603 static void testBitAndNotImm32(int32_t a, int32_t b)
    2604 {
    2605     Procedure proc;
    2606     BasicBlock* root = proc.addBlock();
    2607     Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    2608     Value* notA = root->appendNew<Value>(proc, BitXor, Origin(), argA, root->appendNew<Const32Value>(proc, Origin(), -1));
    2609     Value* cstB = root->appendNew<Const32Value>(proc, Origin(), b);
    2610     root->appendNewControlValue(
    2611         proc, Return, Origin(),
    2612         root->appendNew<Value>(
    2613             proc, BitAnd, Origin(),
    2614             notA,
    2615             cstB));
    2616 
    2617     CHECK_EQ(compileAndRun<int32_t>(proc, a), (~a & b));
     2582    CHECK_EQ(compileAndRun<int64_t>(proc, a, b), (~a & b));
    26182583}
    26192584
     
    30302995}
    30312996
    3032 static void testBitOrAndAndArgs32(int32_t a, int32_t b, int32_t c)
    3033 {
    3034     // We want to check every possible ordering of arguments (to properly check every path in B3ReduceStrength):
    3035     // ((a & b) | (a & c))
    3036     // ((a & b) | (c & a))
    3037     // ((b & a) | (a & c))
    3038     // ((b & a) | (c & a))
    3039     for (int i = 0; i < 4; ++i) {
    3040         Procedure proc;
    3041         BasicBlock* root = proc.addBlock();
    3042         Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    3043         Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    3044         Value* argC = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2));
    3045         Value* andAB = i & 2 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argB)
    3046             : root->appendNew<Value>(proc, BitAnd, Origin(), argB, argA);
    3047         Value* andAC = i & 1 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argC)
    3048             : root->appendNew<Value>(proc, BitAnd, Origin(), argC, argA);
    3049         root->appendNewControlValue(
    3050             proc, Return, Origin(),
    3051             root->appendNew<Value>(
    3052                 proc, BitOr, Origin(),
    3053                 andAB,
    3054                 andAC));
    3055 
    3056         CHECK_EQ(compileAndRun<int32_t>(proc, a, b, c), ((a & b) | (a & c)));
    3057     }
    3058 }
    3059 
    30602997static void testBitOrAndSameArgs(int64_t a, int64_t b)
    30612998{
     
    30803017}
    30813018
    3082 static void testBitOrAndSameArgs32(int32_t a, int32_t b)
    3083 {
    3084     // We want to check every possible ordering of arguments (to properly check every path in B3ReduceStrength):
    3085     // ((a & b) | a)
    3086     // ((b & a) | a)
    3087     // (a | (a & b))
    3088     // (a | (b & a))
    3089     for (int i = 0; i < 4; ++i) {
    3090         Procedure proc;
    3091         BasicBlock* root = proc.addBlock();
    3092         Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    3093         Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    3094         Value* andAB = i & 1 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argB)
    3095             : root->appendNew<Value>(proc, BitAnd, Origin(), argB, argA);
    3096         Value* result = i & 2 ? root->appendNew<Value>(proc, BitOr, Origin(), andAB, argA)
    3097             : root->appendNew<Value>(proc, BitOr, Origin(), argA, andAB);
    3098         root->appendNewControlValue(proc, Return, Origin(), result);
    3099 
    3100         CHECK_EQ(compileAndRun<int32_t>(proc, a, b), ((a & b) | a));
    3101     }
    3102 }
    3103 
    31043019static void testBitOrNotNot(int64_t a, int64_t b)
    31053020{
     
    31203035}
    31213036
    3122 static void testBitOrNotNot32(int32_t a, int32_t b)
    3123 {
    3124     Procedure proc;
    3125     BasicBlock* root = proc.addBlock();
    3126     Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    3127     Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    3128     Value* notA = root->appendNew<Value>(proc, BitXor, Origin(), argA, root->appendNew<Const32Value>(proc, Origin(), -1));
    3129     Value* notB = root->appendNew<Value>(proc, BitXor, Origin(), argB, root->appendNew<Const32Value>(proc, Origin(), -1));
    3130     root->appendNewControlValue(
    3131         proc, Return, Origin(),
    3132         root->appendNew<Value>(
    3133             proc, BitOr, Origin(),
    3134             notA,
    3135             notB));
    3136 
    3137     CHECK_EQ(compileAndRun<int32_t>(proc, a, b), (~a | ~b));
    3138 }
    3139 
    31403037static void testBitOrNotImm(int64_t a, int64_t b)
    31413038{
     
    31533050
    31543051    CHECK_EQ(compileAndRun<int64_t>(proc, a, b), (~a | b));
    3155 }
    3156 
    3157 static void testBitOrNotImm32(int32_t a, int32_t b)
    3158 {
    3159     Procedure proc;
    3160     BasicBlock* root = proc.addBlock();
    3161     Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    3162     Value* notA = root->appendNew<Value>(proc, BitXor, Origin(), argA, root->appendNew<Const32Value>(proc, Origin(), -1));
    3163     Value* cstB = root->appendNew<Const32Value>(proc, Origin(), b);
    3164     root->appendNewControlValue(
    3165         proc, Return, Origin(),
    3166         root->appendNew<Value>(
    3167             proc, BitOr, Origin(),
    3168             notA,
    3169             cstB));
    3170 
    3171     CHECK_EQ(compileAndRun<int32_t>(proc, a), (~a | b));
    31723052}
    31733053
     
    34083288    RUN_BINARY(testBitAndArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
    34093289    RUN_BINARY(testBitAndNotNot, int64Operands(), int64Operands());
    3410     RUN_BINARY(testBitAndNotNot32, int32Operands(), int32Operands());
    34113290    RUN_BINARY(testBitAndNotImm, int64Operands(), int64Operands());
    3412     RUN_BINARY(testBitAndNotImm32, int32Operands(), int32Operands());
    34133291   
    34143292    RUN(testBitOrArgs(43, 43));
     
    34743352    RUN_BINARY(testBitOrArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
    34753353    RUN_TERNARY(testBitOrAndAndArgs, int64Operands(), int64Operands(), int64Operands());
    3476     RUN_TERNARY(testBitOrAndAndArgs32, int32Operands(), int32Operands(), int32Operands());
    34773354    RUN_BINARY(testBitOrAndSameArgs, int64Operands(), int64Operands());
    3478     RUN_BINARY(testBitOrAndSameArgs32, int32Operands(), int32Operands());
    34793355    RUN_BINARY(testBitOrNotNot, int64Operands(), int64Operands());
    3480     RUN_BINARY(testBitOrNotNot32, int32Operands(), int32Operands());
    34813356    RUN_BINARY(testBitOrNotImm, int64Operands(), int64Operands());
    3482     RUN_BINARY(testBitOrNotImm32, int32Operands(), int32Operands());
    34833357   
    34843358    RUN_BINARY(testBitXorArgs, int64Operands(), int64Operands());
     
    35203394    RUN(testBitXorImmBitXorArgImm32(24, 0xffff, 7));
    35213395    RUN_TERNARY(testBitXorAndAndArgs, int64Operands(), int64Operands(), int64Operands());
    3522     RUN_TERNARY(testBitXorAndAndArgs32, int32Operands(), int32Operands(), int32Operands());
    35233396    RUN_BINARY(testBitXorAndSameArgs, int64Operands(), int64Operands());
    3524     RUN_BINARY(testBitXorAndSameArgs32, int32Operands(), int32Operands());
    35253397   
    35263398    RUN_UNARY(testBitNotArg, int64Operands());
  • trunk/Source/JavaScriptCore/b3/testb3_3.cpp

    r249721 r249743  
    260260}
    261261
    262 void testBitXorAndAndArgs32(int32_t a, int32_t b, int32_t c)
    263 {
    264     // We want to check every possible ordering of arguments (to properly check every path in B3ReduceStrength):
    265     // ((a & b) ^ (a & c))
    266     // ((a & b) ^ (c & a))
    267     // ((b & a) ^ (a & c))
    268     // ((b & a) ^ (c & a))
    269     for (int i = 0; i < 4; ++i) {
    270         Procedure proc;
    271         BasicBlock* root = proc.addBlock();
    272         Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    273         Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    274         Value* argC = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR2));
    275         Value* andAB = i & 2 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argB)
    276             : root->appendNew<Value>(proc, BitAnd, Origin(), argB, argA);
    277         Value* andAC = i & 1 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argC)
    278             : root->appendNew<Value>(proc, BitAnd, Origin(), argC, argA);
    279         root->appendNewControlValue(
    280             proc, Return, Origin(),
    281             root->appendNew<Value>(
    282                 proc, BitXor, Origin(),
    283                 andAB,
    284                 andAC));
    285 
    286         CHECK_EQ(compileAndRun<int32_t>(proc, a, b, c), ((a & b) ^ (a & c)));
    287     }
    288 }
    289 
    290262void testBitXorAndSameArgs(int64_t a, int64_t b)
    291263{
     
    307279   
    308280        CHECK_EQ(compileAndRun<int64_t>(proc, a, b), ((a & b) ^ a));
    309     }
    310 }
    311 
    312 void testBitXorAndSameArgs32(int32_t a, int32_t b)
    313 {
    314     // We want to check every possible ordering of arguments (to properly check every path in B3ReduceStrength):
    315     // ((a & b) ^ a)
    316     // ((b & a) ^ a)
    317     // (a ^ (a & b))
    318     // (a ^ (b & a))
    319     for (int i = 0; i < 4; ++i) {
    320         Procedure proc;
    321         BasicBlock* root = proc.addBlock();
    322         Value* argA = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0));
    323         Value* argB = root->appendNew<Value>(proc, Trunc, Origin(), root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
    324         Value* andAB = i & 1 ? root->appendNew<Value>(proc, BitAnd, Origin(), argA, argB)
    325             : root->appendNew<Value>(proc, BitAnd, Origin(), argB, argA);
    326         Value* result = i & 2 ? root->appendNew<Value>(proc, BitXor, Origin(), andAB, argA)
    327             : root->appendNew<Value>(proc, BitXor, Origin(), argA, andAB);
    328         root->appendNewControlValue(proc, Return, Origin(), result);
    329 
    330         CHECK_EQ(compileAndRun<int32_t>(proc, a, b), ((a & b) ^ a));
    331281    }
    332282}
Note: See TracChangeset for help on using the changeset viewer.