Changeset 249743 in webkit
- Timestamp:
- Sep 10, 2019 5:17:03 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r249740 r249743 1 2019-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 1 16 2019-09-10 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r249721 r249743 2750 2750 } 2751 2751 2752 if (m_value->child(1)->isInt 64(0xffffffff) || m_value->child(1)->isInt32(0xffffffff)) {2752 if (m_value->child(1)->isInt(0xffffffff)) { 2753 2753 appendUnOp<Move32, Move32>(m_value->child(0)); 2754 2754 return; -
trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp
r249721 r249743 1034 1034 // Turn this: BitAnd(value, all-ones) 1035 1035 // Into this: value. 1036 if ((m_value->type() == Int64 && m_value->child(1)->isInt 64(std::numeric_limits<uint64_t>::max()))1037 || (m_value->type() == Int32 && m_value->child(1)->isInt 32(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()))) { 1038 1038 replaceWithIdentity(m_value->child(0)); 1039 1039 break; … … 1084 1084 // into this: BitAnd(value, constant2) 1085 1085 if (m_value->child(1)->hasInt()) { 1086 bool replaced = false;1087 1086 int64_t constant2 = m_value->child(1)->asInt(); 1088 1087 switch (m_value->child(0)->opcode()) { … … 1093 1092 m_value->child(0) = m_value->child(0)->child(0); 1094 1093 m_changed = true; 1095 replaced = true;1096 1094 break; 1097 1095 } … … 1100 1098 break; 1101 1099 } 1102 if (replaced) 1103 break; 1100 break; 1104 1101 } 1105 1102 … … 1110 1107 && m_value->child(1)->opcode() == BitXor 1111 1108 && ((m_value->type() == Int64 1112 && m_value->child(0)->child(1)->isInt 64(std::numeric_limits<uint64_t>::max())1113 && m_value->child(1)->child(1)->isInt 64(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())) 1114 1111 || (m_value->type() == Int32 1115 && m_value->child(0)->child(1)->isInt 32(std::numeric_limits<uint32_t>::max())1116 && m_value->child(1)->child(1)->isInt 32(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())))) { 1117 1114 Value* bitOr = m_insertionSet.insert<Value>(m_index, BitOr, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->child(0)); 1118 1115 replaceWithNew<Value>(BitXor, m_value->origin(), bitOr, m_value->child(1)->child(1)); … … 1127 1124 && m_value->child(1)->hasInt() 1128 1125 && ((m_value->type() == Int64 1129 && m_value->child(0)->child(1)->isInt 64(std::numeric_limits<uint64_t>::max()))1126 && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max())) 1130 1127 || (m_value->type() == Int32 1131 && m_value->child(0)->child(1)->isInt 32(std::numeric_limits<uint32_t>::max())))) {1128 && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) { 1132 1129 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))); 1133 1130 replaceWithNew<Value>(BitXor, m_value->origin(), bitOr, m_value->child(0)->child(1)); … … 1175 1172 // Turn this: BitOr(value, all-ones) 1176 1173 // Into this: all-ones. 1177 if ((m_value->type() == Int64 && m_value->child(1)->isInt 64(std::numeric_limits<uint64_t>::max()))1178 || (m_value->type() == Int32 && m_value->child(1)->isInt 32(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()))) { 1179 1176 replaceWithIdentity(m_value->child(1)); 1180 1177 break; … … 1187 1184 && m_value->child(1)->opcode() == BitXor 1188 1185 && ((m_value->type() == Int64 1189 && m_value->child(0)->child(1)->isInt 64(std::numeric_limits<uint64_t>::max())1190 && m_value->child(1)->child(1)->isInt 64(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())) 1191 1188 || (m_value->type() == Int32 1192 && m_value->child(0)->child(1)->isInt 32(std::numeric_limits<uint32_t>::max())1193 && m_value->child(1)->child(1)->isInt 32(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())))) { 1194 1191 Value* bitAnd = m_insertionSet.insert<Value>(m_index, BitAnd, m_value->origin(), m_value->child(0)->child(0), m_value->child(1)->child(0)); 1195 1192 replaceWithNew<Value>(BitXor, m_value->origin(), bitAnd, m_value->child(1)->child(1)); … … 1204 1201 && m_value->child(1)->hasInt() 1205 1202 && ((m_value->type() == Int64 1206 && m_value->child(0)->child(1)->isInt 64(std::numeric_limits<uint64_t>::max()))1203 && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint64_t>::max())) 1207 1204 || (m_value->type() == Int32 1208 && m_value->child(0)->child(1)->isInt 32(std::numeric_limits<uint32_t>::max())))) {1205 && m_value->child(0)->child(1)->isInt(std::numeric_limits<uint32_t>::max())))) { 1209 1206 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))); 1210 1207 replaceWithNew<Value>(BitXor, m_value->origin(), bitAnd, m_value->child(0)->child(1)); -
trunk/Source/JavaScriptCore/b3/testb3.h
r249721 r249743 460 460 void testBitXorSameArg(int64_t); 461 461 void testBitXorAndAndArgs(int64_t, int64_t, int64_t c); 462 void testBitXorAndAndArgs32(int32_t, int32_t, int32_t c);463 462 void testBitXorAndSameArgs(int64_t, int64_t); 464 void testBitXorAndSameArgs32(int32_t, int32_t);465 463 void testBitXorImms(int64_t, int64_t); 466 464 void testBitXorArgImm(int64_t, int64_t); -
trunk/Source/JavaScriptCore/b3/testb3_2.cpp
r249721 r249743 2566 2566 } 2567 2567 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 2586 2568 static void testBitAndNotImm(int64_t a, int64_t b) 2587 2569 { … … 2598 2580 cstB)); 2599 2581 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)); 2618 2583 } 2619 2584 … … 3030 2995 } 3031 2996 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 3060 2997 static void testBitOrAndSameArgs(int64_t a, int64_t b) 3061 2998 { … … 3080 3017 } 3081 3018 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 3104 3019 static void testBitOrNotNot(int64_t a, int64_t b) 3105 3020 { … … 3120 3035 } 3121 3036 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 3140 3037 static void testBitOrNotImm(int64_t a, int64_t b) 3141 3038 { … … 3153 3050 3154 3051 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));3172 3052 } 3173 3053 … … 3408 3288 RUN_BINARY(testBitAndArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>()); 3409 3289 RUN_BINARY(testBitAndNotNot, int64Operands(), int64Operands()); 3410 RUN_BINARY(testBitAndNotNot32, int32Operands(), int32Operands());3411 3290 RUN_BINARY(testBitAndNotImm, int64Operands(), int64Operands()); 3412 RUN_BINARY(testBitAndNotImm32, int32Operands(), int32Operands());3413 3291 3414 3292 RUN(testBitOrArgs(43, 43)); … … 3474 3352 RUN_BINARY(testBitOrArgsFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>()); 3475 3353 RUN_TERNARY(testBitOrAndAndArgs, int64Operands(), int64Operands(), int64Operands()); 3476 RUN_TERNARY(testBitOrAndAndArgs32, int32Operands(), int32Operands(), int32Operands());3477 3354 RUN_BINARY(testBitOrAndSameArgs, int64Operands(), int64Operands()); 3478 RUN_BINARY(testBitOrAndSameArgs32, int32Operands(), int32Operands());3479 3355 RUN_BINARY(testBitOrNotNot, int64Operands(), int64Operands()); 3480 RUN_BINARY(testBitOrNotNot32, int32Operands(), int32Operands());3481 3356 RUN_BINARY(testBitOrNotImm, int64Operands(), int64Operands()); 3482 RUN_BINARY(testBitOrNotImm32, int32Operands(), int32Operands());3483 3357 3484 3358 RUN_BINARY(testBitXorArgs, int64Operands(), int64Operands()); … … 3520 3394 RUN(testBitXorImmBitXorArgImm32(24, 0xffff, 7)); 3521 3395 RUN_TERNARY(testBitXorAndAndArgs, int64Operands(), int64Operands(), int64Operands()); 3522 RUN_TERNARY(testBitXorAndAndArgs32, int32Operands(), int32Operands(), int32Operands());3523 3396 RUN_BINARY(testBitXorAndSameArgs, int64Operands(), int64Operands()); 3524 RUN_BINARY(testBitXorAndSameArgs32, int32Operands(), int32Operands());3525 3397 3526 3398 RUN_UNARY(testBitNotArg, int64Operands()); -
trunk/Source/JavaScriptCore/b3/testb3_3.cpp
r249721 r249743 260 260 } 261 261 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 290 262 void testBitXorAndSameArgs(int64_t a, int64_t b) 291 263 { … … 307 279 308 280 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));331 281 } 332 282 }
Note: See TracChangeset
for help on using the changeset viewer.