WebKit Bugzilla
Attachment 362242 Details for
Bug 194637
: testb3 and testair should test O0/O1/O2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
b-backup.diff (text/plain), 36.72 KB, created by
Saam Barati
on 2019-02-17 12:41:39 PST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2019-02-17 12:41:39 PST
Size:
36.72 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 241651) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,96 @@ >+2019-02-17 Saam Barati <sbarati@apple.com> >+ >+ testb3 and testair should test O0/O1/O2 >+ https://bugs.webkit.org/show_bug.cgi?id=194637 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch makes it so that we run all tests in testair and testb3 >+ in O0, O1, and O2. However, some tests are invalid for O0 and O1. >+ This patch makes it so we only run those tests in O2. These are >+ often tests that assert certain optimizations have occurred. There >+ are also a class of tests that rely on using patchpoints to stress >+ the register allocator into only a single valid allocation. The >+ O0, and sometimes O1, register allocators are not always good enough >+ to allocate such programs. To make these valid allocators to use, we rely >+ on the FTL and Wasm to not emit such patchpoints. >+ >+ * b3/air/testair.cpp: >+ (main): >+ * b3/testb3.cpp: >+ (JSC::B3::compileProc): >+ (JSC::B3::testAddLoadTwice): >+ (JSC::B3::testMulLoadTwice): >+ (JSC::B3::testBitNotOnBooleanAndBranch32): >+ (JSC::B3::testSimplePatchpointWithOuputClobbersGPArgs): >+ (JSC::B3::testSimplePatchpointWithOuputClobbersFPArgs): >+ (JSC::B3::testPatchpointWithEarlyClobber): >+ (JSC::B3::testSimpleCheck): >+ (JSC::B3::testCheckFalse): >+ (JSC::B3::testCheckTrue): >+ (JSC::B3::testCheckLessThan): >+ (JSC::B3::testCheckMegaCombo): >+ (JSC::B3::testCheckTrickyMegaCombo): >+ (JSC::B3::testCheckTwoMegaCombos): >+ (JSC::B3::testCheckTwoNonRedundantMegaCombos): >+ (JSC::B3::testCheckAddImm): >+ (JSC::B3::testCheckAddImmCommute): >+ (JSC::B3::testCheckAddImmSomeRegister): >+ (JSC::B3::testCheckAdd): >+ (JSC::B3::testCheckAdd64): >+ (JSC::B3::testCheckAddFold): >+ (JSC::B3::testCheckAddFoldFail): >+ (JSC::B3::testCheckAddSelfOverflow64): >+ (JSC::B3::testCheckAddSelfOverflow32): >+ (JSC::B3::testCheckSubImm): >+ (JSC::B3::testCheckSubBadImm): >+ (JSC::B3::testCheckSub): >+ (JSC::B3::testCheckSub64): >+ (JSC::B3::testCheckSubFold): >+ (JSC::B3::testCheckSubFoldFail): >+ (JSC::B3::testCheckNeg): >+ (JSC::B3::testCheckNeg64): >+ (JSC::B3::testCheckMul): >+ (JSC::B3::testCheckMulMemory): >+ (JSC::B3::testCheckMul2): >+ (JSC::B3::testCheckMul64): >+ (JSC::B3::testCheckMulFold): >+ (JSC::B3::testCheckMulFoldFail): >+ (JSC::B3::testCheckMul64SShr): >+ (JSC::B3::testLinearScanWithCalleeOnStack): >+ (JSC::B3::testCheckSelect): >+ (JSC::B3::testCheckSelectCheckSelect): >+ (JSC::B3::testCheckSelectAndCSE): >+ (JSC::B3::testLateRegister): >+ (JSC::B3::testReduceStrengthCheckBottomUseInAnotherBlock): >+ (JSC::B3::testSomeEarlyRegister): >+ (JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled2): >+ (JSC::B3::testPinRegisters): >+ (JSC::B3::testX86LeaAddAddShlLeft): >+ (JSC::B3::testX86LeaAddAddShlRight): >+ (JSC::B3::testX86LeaAddAdd): >+ (JSC::B3::testX86LeaAddShlRight): >+ (JSC::B3::testX86LeaAddShlLeftScale1): >+ (JSC::B3::testX86LeaAddShlLeftScale2): >+ (JSC::B3::testX86LeaAddShlLeftScale4): >+ (JSC::B3::testX86LeaAddShlLeftScale8): >+ (JSC::B3::testLoadBaseIndexShift2): >+ (JSC::B3::testOptimizeMaterialization): >+ (JSC::B3::testLICMPure): >+ (JSC::B3::testLICMPureSideExits): >+ (JSC::B3::testLICMPureWritesPinned): >+ (JSC::B3::testLICMPureWrites): >+ (JSC::B3::testLICMReadsPinned): >+ (JSC::B3::testLICMReads): >+ (JSC::B3::testLICMPureNotBackwardsDominant): >+ (JSC::B3::testLICMPureNotBackwardsDominantFoiledByChild): >+ (JSC::B3::testLICMControlDependent): >+ (JSC::B3::testLICMControlDependentNotBackwardsDominant): >+ (JSC::B3::testLICMReadsWritesDifferentHeaps): >+ (JSC::B3::testWasmBoundsCheck): >+ (JSC::B3::run): >+ (main): >+ > 2019-02-17 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r241612. >Index: Source/JavaScriptCore/b3/testb3.cpp >=================================================================== >--- Source/JavaScriptCore/b3/testb3.cpp (revision 241650) >+++ Source/JavaScriptCore/b3/testb3.cpp (working copy) >@@ -121,7 +121,7 @@ Lock crashLock; > CRASH(); \ > } while (false) > >-std::unique_ptr<Compilation> compileProc(Procedure& procedure, unsigned optLevel = defaultOptLevel()) >+std::unique_ptr<Compilation> compileProc(Procedure& procedure, unsigned optLevel = Options::defaultB3OptLevel()) > { > procedure.setOptLevel(optLevel); > return std::make_unique<Compilation>(B3::compile(procedure)); >@@ -660,7 +660,7 @@ void testAddArgZeroImmZDef() > > void testAddLoadTwice() > { >- auto test = [&] (unsigned optLevel) { >+ auto test = [&] () { > Procedure proc; > BasicBlock* root = proc.addBlock(); > int32_t value = 42; >@@ -671,12 +671,11 @@ void testAddLoadTwice() > proc, Return, Origin(), > root->appendNew<Value>(proc, Add, Origin(), load, load)); > >- auto code = compileProc(proc, optLevel); >+ auto code = compileProc(proc); > CHECK(invoke<int32_t>(*code) == 42 * 2); > }; > >- test(0); >- test(1); >+ test(); > } > > void testAddArgDouble(double a) >@@ -1012,7 +1011,7 @@ void testMulArgs32(int a, int b) > > void testMulLoadTwice() > { >- auto test = [&] (unsigned optLevel) { >+ auto test = [&] () { > Procedure proc; > BasicBlock* root = proc.addBlock(); > int32_t value = 42; >@@ -1023,13 +1022,11 @@ void testMulLoadTwice() > proc, Return, Origin(), > root->appendNew<Value>(proc, Mul, Origin(), load, load)); > >- auto code = compileProc(proc, optLevel); >+ auto code = compileProc(proc); > CHECK(invoke<int32_t>(*code) == 42 * 42); > }; > >- test(0); >- test(1); >- test(2); >+ test(); > } > > void testMulAddArgsLeft() >@@ -3534,7 +3531,7 @@ void testBitNotOnBooleanAndBranch32(int6 > root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)); > Value* argsAreEqual = root->appendNew<Value>(proc, Equal, Origin(), arg1, arg2); > Value* argsAreNotEqual = root->appendNew<Value>(proc, BitXor, Origin(), >- root->appendNew<Const32Value>(proc, Origin(), -1), >+ root->appendNew<Const32Value>(proc, Origin(), 1), > argsAreEqual); > > root->appendNewControlValue( >@@ -8257,6 +8254,13 @@ void testSimplePatchpointWithOuputClobbe > // spill everything else. > > Procedure proc; >+ if (proc.optLevel() < 1) { >+ // FIXME: Air O0 allocator can't handle such programs. We rely on WasmAirIRGenerator >+ // to not use any such constructs where the register allocator is cornered in such >+ // a way. >+ // https://bugs.webkit.org/show_bug.cgi?id=194633 >+ return; >+ } > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1); >@@ -8330,6 +8334,13 @@ void testSimplePatchpointWithoutOuputClo > void testSimplePatchpointWithOuputClobbersFPArgs() > { > Procedure proc; >+ if (proc.optLevel() < 1) { >+ // FIXME: Air O0 allocator can't handle such programs. We rely on WasmAirIRGenerator >+ // to not use any such constructs where the register allocator is cornered in such >+ // a way. >+ // https://bugs.webkit.org/show_bug.cgi?id=194633 >+ return; >+ } > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), FPRInfo::argumentFPR1); >@@ -8380,10 +8391,13 @@ void testPatchpointWithEarlyClobber() > patchpoint->append(ConstrainedValue(arg1, ValueRep::SomeRegister)); > patchpoint->append(ConstrainedValue(arg2, ValueRep::SomeRegister)); > patchpoint->clobberEarly(RegisterSet(registerToClobber)); >+ unsigned optLevel = proc.optLevel(); > patchpoint->setGenerator( > [&] (CCallHelpers& jit, const StackmapGenerationParams& params) { >- CHECK((params[1].gpr() == GPRInfo::argumentGPR0) == arg1InArgGPR); >- CHECK((params[2].gpr() == GPRInfo::argumentGPR1) == arg2InArgGPR); >+ if (optLevel > 1) { >+ CHECK((params[1].gpr() == GPRInfo::argumentGPR0) == arg1InArgGPR); >+ CHECK((params[2].gpr() == GPRInfo::argumentGPR1) == arg2InArgGPR); >+ } > > add32(jit, params[1].gpr(), params[2].gpr(), params[0].gpr()); > }); >@@ -8719,6 +8733,8 @@ void testPatchpointWithAnyResult() > void testSimpleCheck() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > CheckValue* check = root->appendNew<CheckValue>(proc, Check, Origin(), arg); >@@ -8748,9 +8764,11 @@ void testCheckFalse() > BasicBlock* root = proc.addBlock(); > CheckValue* check = root->appendNew<CheckValue>( > proc, Check, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0)); >+ unsigned optLevel = proc.optLevel(); > check->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams&) { >- CHECK(!"This should not have executed"); >+ if (optLevel > 1) >+ CHECK(!"This should not have executed"); > }); > root->appendNewControlValue( > proc, Return, Origin(), root->appendNew<Const32Value>(proc, Origin(), 0)); >@@ -8763,13 +8781,17 @@ void testCheckFalse() > void testCheckTrue() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > CheckValue* check = root->appendNew<CheckValue>( > proc, Check, Origin(), root->appendNew<Const32Value>(proc, Origin(), 1)); >+ unsigned optLevel = proc.optLevel(); > check->setGenerator( > [&] (CCallHelpers& jit, const StackmapGenerationParams& params) { > AllowMacroScratchRegisterUsage allowScratch(jit); >- CHECK(params.value()->opcode() == Patchpoint); >+ if (optLevel > 1) >+ CHECK(params.value()->opcode() == Patchpoint); > CHECK(!params.size()); > > // This should always work because a function this simple should never have callee >@@ -8789,6 +8811,8 @@ void testCheckTrue() > void testCheckLessThan() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -8824,6 +8848,8 @@ void testCheckLessThan() > void testCheckMegaCombo() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* base = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* index = root->appendNew<Value>( >@@ -8876,6 +8902,8 @@ void testCheckMegaCombo() > void testCheckTrickyMegaCombo() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* base = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* index = root->appendNew<Value>( >@@ -8931,6 +8959,8 @@ void testCheckTrickyMegaCombo() > void testCheckTwoMegaCombos() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* base = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* index = root->appendNew<Value>( >@@ -8995,6 +9025,8 @@ void testCheckTwoMegaCombos() > void testCheckTwoNonRedundantMegaCombos() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > > BasicBlock* root = proc.addBlock(); > BasicBlock* thenCase = proc.addBlock(); >@@ -9088,6 +9120,8 @@ void testCheckTwoNonRedundantMegaCombos( > void testCheckAddImm() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9124,6 +9158,8 @@ void testCheckAddImm() > void testCheckAddImmCommute() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9160,6 +9196,8 @@ void testCheckAddImmCommute() > void testCheckAddImmSomeRegister() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9195,6 +9233,8 @@ void testCheckAddImmSomeRegister() > void testCheckAdd() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9232,6 +9272,8 @@ void testCheckAdd() > void testCheckAdd64() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1); >@@ -9269,9 +9311,11 @@ void testCheckAddFold(int a, int b) > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); > CheckValue* checkAdd = root->appendNew<CheckValue>(proc, CheckAdd, Origin(), arg1, arg2); >+ unsigned optLevel = proc.optLevel(); > checkAdd->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams&) { >- CHECK(!"Should have been folded"); >+ if (optLevel > 1) >+ CHECK(!"Should have been folded"); > }); > root->appendNewControlValue(proc, Return, Origin(), checkAdd); > >@@ -9283,6 +9327,8 @@ void testCheckAddFold(int a, int b) > void testCheckAddFoldFail(int a, int b) > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); >@@ -9384,6 +9430,8 @@ void testCheckAddArgumentAliasing32() > void testCheckAddSelfOverflow64() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > CheckValue* checkAdd = root->appendNew<CheckValue>(proc, CheckAdd, Origin(), arg, arg); >@@ -9413,6 +9461,8 @@ void testCheckAddSelfOverflow64() > void testCheckAddSelfOverflow32() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9444,6 +9494,8 @@ void testCheckAddSelfOverflow32() > void testCheckSubImm() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9480,6 +9532,8 @@ void testCheckSubImm() > void testCheckSubBadImm() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9522,6 +9576,8 @@ void testCheckSubBadImm() > void testCheckSub() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9564,6 +9620,8 @@ NEVER_INLINE double doubleSub(double a, > void testCheckSub64() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1); >@@ -9601,9 +9659,11 @@ void testCheckSubFold(int a, int b) > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); > CheckValue* checkSub = root->appendNew<CheckValue>(proc, CheckSub, Origin(), arg1, arg2); >+ unsigned optLevel = proc.optLevel(); > checkSub->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams&) { >- CHECK(!"Should have been folded"); >+ if (optLevel > 1) >+ CHECK(!"Should have been folded"); > }); > root->appendNewControlValue(proc, Return, Origin(), checkSub); > >@@ -9615,6 +9675,8 @@ void testCheckSubFold(int a, int b) > void testCheckSubFoldFail(int a, int b) > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); >@@ -9636,6 +9698,8 @@ void testCheckSubFoldFail(int a, int b) > void testCheckNeg() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), 0); > Value* arg2 = root->appendNew<Value>( >@@ -9668,6 +9732,8 @@ void testCheckNeg() > void testCheckNeg64() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Const64Value>(proc, Origin(), 0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); >@@ -9698,6 +9764,8 @@ void testCheckNeg64() > void testCheckMul() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9735,6 +9803,8 @@ void testCheckMul() > void testCheckMulMemory() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > > int left; >@@ -9787,6 +9857,8 @@ void testCheckMulMemory() > void testCheckMul2() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, Trunc, Origin(), >@@ -9823,6 +9895,8 @@ void testCheckMul2() > void testCheckMul64() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0); > Value* arg2 = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1); >@@ -9860,9 +9934,11 @@ void testCheckMulFold(int a, int b) > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); > CheckValue* checkMul = root->appendNew<CheckValue>(proc, CheckMul, Origin(), arg1, arg2); >+ unsigned optLevel = proc.optLevel(); > checkMul->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams&) { >- CHECK(!"Should have been folded"); >+ if (optLevel > 1) >+ CHECK(!"Should have been folded"); > }); > root->appendNewControlValue(proc, Return, Origin(), checkMul); > >@@ -9874,6 +9950,8 @@ void testCheckMulFold(int a, int b) > void testCheckMulFoldFail(int a, int b) > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), a); > Value* arg2 = root->appendNew<Const32Value>(proc, Origin(), b); >@@ -9975,6 +10053,8 @@ void testCheckMulArgumentAliasing32() > void testCheckMul64SShr() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > Value* arg1 = root->appendNew<Value>( > proc, SShr, Origin(), >@@ -10625,7 +10705,7 @@ void testLinearScanWithCalleeOnStack() > > // Compiling with 1 as the optimization level enforces the use of linear scan > // for register allocation. >- auto code = compileProc(proc, 1); >+ auto code = compileProc(proc); > CHECK_EQ(invoke<int>(*code, 41, 1), 42); > > Options::airLinearScanSpillsEverything() = original; >@@ -12180,6 +12260,8 @@ void testSelectInvert() > void testCheckSelect() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > > CheckValue* check = root->appendNew<CheckValue>( >@@ -12222,6 +12304,8 @@ void testCheckSelect() > void testCheckSelectCheckSelect() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > > CheckValue* check = root->appendNew<CheckValue>( >@@ -12295,6 +12379,8 @@ void testCheckSelectCheckSelect() > void testCheckSelectAndCSE() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > BasicBlock* root = proc.addBlock(); > > auto* selectValue = root->appendNew<Value>( >@@ -13029,6 +13115,13 @@ void testSpillUseLargerThanDef() > void testLateRegister() > { > Procedure proc; >+ >+ if (!proc.optLevel()) { >+ // FIXME: Make O0 handle such situations: >+ // https://bugs.webkit.org/show_bug.cgi?id=194633 >+ return; >+ } >+ > BasicBlock* root = proc.addBlock(); > > // This works by making all but 1 register be input to the first patchpoint as LateRegister. >@@ -13340,6 +13433,8 @@ void testInterpreter() > void testReduceStrengthCheckBottomUseInAnotherBlock() > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > > BasicBlock* one = proc.addBlock(); > BasicBlock* two = proc.addBlock(); >@@ -13782,12 +13877,15 @@ void testSomeEarlyRegister() > if (succeed) > patchpoint->resultConstraint = ValueRep::SomeEarlyRegister; > bool ranSecondPatchpoint = false; >+ unsigned optLevel = proc.optLevel(); > patchpoint->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams& params) { > if (succeed) > CHECK(params[0].gpr() != params[1].gpr()); >- else >- CHECK(params[0].gpr() == params[1].gpr()); >+ else { >+ if (optLevel > 1) >+ CHECK(params[0].gpr() == params[1].gpr()); >+ } > ranSecondPatchpoint = true; > }); > >@@ -13910,8 +14008,16 @@ void testTerminalPatchpointThatNeedsToBe > > void testTerminalPatchpointThatNeedsToBeSpilled2() > { >+ > // This is a unit test for how FTL's heap allocation fast paths behave. > Procedure proc; >+ >+ // FIXME: Air O0/O1 allocator can't handle such programs. We rely on WasmAirIRGenerator >+ // to not use any such constructs where the register allocator is cornered in such >+ // a way. >+ // https://bugs.webkit.org/show_bug.cgi?id=194633 >+ if (proc.optLevel() < 2) >+ return; > > BasicBlock* root = proc.addBlock(); > BasicBlock* one = proc.addBlock(); >@@ -14372,9 +14478,11 @@ void testPinRegisters() > a, b, c); > PatchpointValue* patchpoint = root->appendNew<PatchpointValue>(proc, Void, Origin()); > patchpoint->appendSomeRegister(d); >+ unsigned optLevel = proc.optLevel(); > patchpoint->setGenerator( > [&] (CCallHelpers&, const StackmapGenerationParams& params) { >- CHECK_EQ(params[0].gpr(), GPRInfo::regCS0); >+ if (optLevel > 1) >+ CHECK_EQ(params[0].gpr(), GPRInfo::regCS0); > }); > root->appendNew<Value>(proc, Return, Origin()); > auto code = compileProc(proc); >@@ -14390,6 +14498,11 @@ void testPinRegisters() > }); > } > } >+ if (proc.optLevel() < 2) { >+ // Our less good register allocators may use the >+ // pinned CSRs in a move. >+ usesCSRs = false; >+ } > for (const RegisterAtOffset& regAtOffset : proc.calleeSaveRegisterAtOffsetList()) > usesCSRs |= csrs.get(regAtOffset.reg()); > CHECK_EQ(usesCSRs, !pin); >@@ -14417,7 +14530,10 @@ void testX86LeaAddAddShlLeft() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + (2 << 2)) + 100); > } > >@@ -14439,7 +14555,10 @@ void testX86LeaAddAddShlRight() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea 0x64(%rdi,%rsi,4), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + (2 << 2)) + 100); > } > >@@ -14459,13 +14578,15 @@ void testX86LeaAddAdd() > > auto code = compileProc(proc); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), (1 + 2) + 100); >- checkDisassembly( >- *code, >- [&] (const char* disassembly) -> bool { >- return strstr(disassembly, "lea 0x64(%rdi,%rsi), %rax") >- || strstr(disassembly, "lea 0x64(%rsi,%rdi), %rax"); >- }, >- "Expected to find something like lea 0x64(%rdi,%rsi), %rax but didn't!"); >+ if (proc.optLevel() > 1) { >+ checkDisassembly( >+ *code, >+ [&] (const char* disassembly) -> bool { >+ return strstr(disassembly, "lea 0x64(%rdi,%rsi), %rax") >+ || strstr(disassembly, "lea 0x64(%rsi,%rdi), %rax"); >+ }, >+ "Expected to find something like lea 0x64(%rdi,%rsi), %rax but didn't!"); >+ } > } > > void testX86LeaAddShlRight() >@@ -14483,7 +14604,10 @@ void testX86LeaAddShlRight() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 2)); > } > >@@ -14503,13 +14627,15 @@ void testX86LeaAddShlLeftScale1() > > auto code = compileProc(proc); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + 2); >- checkDisassembly( >- *code, >- [&] (const char* disassembly) -> bool { >- return strstr(disassembly, "lea (%rdi,%rsi), %rax") >- || strstr(disassembly, "lea (%rsi,%rdi), %rax"); >- }, >- "Expected to find something like lea (%rdi,%rsi), %rax but didn't!"); >+ if (proc.optLevel() > 1) { >+ checkDisassembly( >+ *code, >+ [&] (const char* disassembly) -> bool { >+ return strstr(disassembly, "lea (%rdi,%rsi), %rax") >+ || strstr(disassembly, "lea (%rsi,%rdi), %rax"); >+ }, >+ "Expected to find something like lea (%rdi,%rsi), %rax but didn't!"); >+ } > } > > void testX86LeaAddShlLeftScale2() >@@ -14527,7 +14653,10 @@ void testX86LeaAddShlLeftScale2() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea (%rdi,%rsi,2), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea (%rdi,%rsi,2), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 1)); > } > >@@ -14546,7 +14675,10 @@ void testX86LeaAddShlLeftScale4() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea (%rdi,%rsi,4), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 2)); > } > >@@ -14565,7 +14697,10 @@ void testX86LeaAddShlLeftScale8() > root->appendNew<Value>(proc, Return, Origin(), result); > > auto code = compileProc(proc); >- checkUsesInstruction(*code, "lea (%rdi,%rsi,8), %rax"); >+ if (proc.optLevel() > 1) >+ checkUsesInstruction(*code, "lea (%rdi,%rsi,8), %rax"); >+ else >+ checkUsesInstruction(*code, "lea"); > CHECK_EQ(invoke<intptr_t>(*code, 1, 2), 1 + (2 << 3)); > } > >@@ -14684,7 +14819,7 @@ void testLoadBaseIndexShift2() > root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1), > root->appendNew<Const32Value>(proc, Origin(), 2))))); > auto code = compileProc(proc); >- if (isX86()) >+ if (isX86() && proc.optLevel() > 1) > checkUsesInstruction(*code, "(%rdi,%rsi,4)"); > int32_t value = 12341234; > char* ptr = bitwise_cast<char*>(&value); >@@ -14719,6 +14854,9 @@ void testLoadBaseIndexShift32() > void testOptimizeMaterialization() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; >+ > BasicBlock* root = proc.addBlock(); > root->appendNew<CCallValue>( > proc, Void, Origin(), >@@ -14847,6 +14985,10 @@ static void noOpFunction() > void testLICMPure() > { > Procedure proc; >+ >+ if (proc.optLevel() < 2) >+ return; >+ > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14864,6 +15006,8 @@ void testLICMPure() > void testLICMPureSideExits() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14887,6 +15031,8 @@ void testLICMPureSideExits() > void testLICMPureWritesPinned() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14910,6 +15056,8 @@ void testLICMPureWritesPinned() > void testLICMPureWrites() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14952,6 +15100,8 @@ void testLICMReadsLocalState() > void testLICMReadsPinned() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14971,6 +15121,8 @@ void testLICMReadsPinned() > void testLICMReads() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -14990,6 +15142,8 @@ void testLICMReads() > void testLICMPureNotBackwardsDominant() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > auto array = makeArrayForLoops(); > generateLoopNotBackwardsDominant( > proc, array, >@@ -15026,6 +15180,8 @@ void testLICMPureFoiledByChild() > void testLICMPureNotBackwardsDominantFoiledByChild() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > auto array = makeArrayForLoops(); > generateLoopNotBackwardsDominant( > proc, array, >@@ -15140,6 +15296,8 @@ void testLICMWritesPinned() > void testLICMControlDependent() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -15159,6 +15317,8 @@ void testLICMControlDependent() > void testLICMControlDependentNotBackwardsDominant() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > auto array = makeArrayForLoops(); > generateLoopNotBackwardsDominant( > proc, array, >@@ -15229,6 +15389,8 @@ void testLICMReadsPinnedWritesPinned() > void testLICMReadsWritesDifferentHeaps() > { > Procedure proc; >+ if (proc.optLevel() < 2) >+ return; > generateLoop( > proc, > [&] (BasicBlock* loop, Value*) -> Value* { >@@ -16010,6 +16172,8 @@ void testDepend64() > void testWasmBoundsCheck(unsigned offset) > { > Procedure proc; >+ if (proc.optLevel() < 1) >+ return; > GPRReg pinned = GPRInfo::argumentGPR1; > proc.pinRegister(pinned); > >@@ -16377,12 +16541,14 @@ double negativeZero() > return -zero(); > } > >+#define PREFIX "O", Options::defaultB3OptLevel(), ": " >+ > #define RUN_NOW(test) do { \ > if (!shouldRun(#test)) \ > break; \ >- dataLog(#test "...\n"); \ >+ dataLog(PREFIX #test "...\n"); \ > test; \ >- dataLog(#test ": OK!\n"); \ >+ dataLog(PREFIX #test ": OK!\n"); \ > } while (false) > #define RUN(test) do { \ > if (!shouldRun(#test)) \ >@@ -16390,15 +16556,15 @@ double negativeZero() > tasks.append( \ > createSharedTask<void()>( \ > [&] () { \ >- dataLog(#test "...\n"); \ >+ dataLog(PREFIX #test "...\n"); \ > test; \ >- dataLog(#test ": OK!\n"); \ >+ dataLog(PREFIX #test ": OK!\n"); \ > })); \ > } while (false); > > #define RUN_UNARY(test, values) \ > for (auto a : values) { \ >- CString testStr = toCString(#test, "(", a.name, ")"); \ >+ CString testStr = toCString(PREFIX #test, "(", a.name, ")"); \ > if (!shouldRun(testStr.data())) \ > continue; \ > tasks.append(createSharedTask<void()>( \ >@@ -16412,7 +16578,7 @@ double negativeZero() > #define RUN_BINARY(test, valuesA, valuesB) \ > for (auto a : valuesA) { \ > for (auto b : valuesB) { \ >- CString testStr = toCString(#test, "(", a.name, ", ", b.name, ")"); \ >+ CString testStr = toCString(PREFIX #test, "(", a.name, ", ", b.name, ")"); \ > if (!shouldRun(testStr.data())) \ > continue; \ > tasks.append(createSharedTask<void()>( \ >@@ -16426,8 +16592,6 @@ double negativeZero() > > void run(const char* filter) > { >- JSC::initializeThreading(); >- > Deque<RefPtr<SharedTask<void()>>> tasks; > > auto shouldRun = [&] (const char* testName) -> bool { >@@ -17995,6 +18159,7 @@ void run(const char* filter) > for (auto& thread : threads) > thread->waitForCompletion(); > crashLock.lock(); >+ crashLock.unlock(); > } > > } // anonymous namespace >@@ -18021,8 +18186,14 @@ int main(int argc, char** argv) > usage(); > break; > } >+ >+ JSC::initializeThreading(); > >- run(filter); >+ for (unsigned i = 0; i <= 2; ++i) { >+ Options::defaultB3OptLevel() = i; >+ run(filter); >+ } >+ > return 0; > } > >Index: Source/JavaScriptCore/b3/air/testair.cpp >=================================================================== >--- Source/JavaScriptCore/b3/air/testair.cpp (revision 241650) >+++ Source/JavaScriptCore/b3/air/testair.cpp (working copy) >@@ -2062,22 +2062,22 @@ void testLea32() > CHECK(r == a + b); > } > >+#define PREFIX "O", Options::defaultB3OptLevel(), ": " >+ > #define RUN(test) do { \ > if (!shouldRun(#test)) \ > break; \ > tasks.append( \ > createSharedTask<void()>( \ > [&] () { \ >- dataLog(#test "...\n"); \ >+ dataLog(PREFIX #test "...\n"); \ > test; \ >- dataLog(#test ": OK!\n"); \ >+ dataLog(PREFIX #test ": OK!\n"); \ > })); \ > } while (false); > > void run(const char* filter) > { >- JSC::initializeThreading(); >- > Deque<RefPtr<SharedTask<void()>>> tasks; > > auto shouldRun = [&] (const char* testName) -> bool { >@@ -2178,6 +2178,7 @@ void run(const char* filter) > for (auto& thread : threads) > thread->waitForCompletion(); > crashLock.lock(); >+ crashLock.unlock(); > } > > } // anonymous namespace >@@ -2205,6 +2206,12 @@ int main(int argc, char** argv) > break; > } > >- run(filter); >+ JSC::initializeThreading(); >+ >+ for (unsigned i = 0; i <= 2; ++i) { >+ Options::defaultB3OptLevel() = i; >+ run(filter); >+ } >+ > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mark.lam
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194637
:
362096
| 362242 |
362253