mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865931 - Fix varous minor problems with the comparison routines, add test r=shu
This commit is contained in:
parent
2722beb5e2
commit
28f1991970
@ -117,7 +117,7 @@ class ParallelArrayVisitor : public MInstructionVisitor
|
||||
SAFE_OP(TableSwitch)
|
||||
SAFE_OP(Goto)
|
||||
CUSTOM_OP(Test)
|
||||
CUSTOM_OP(Compare)
|
||||
SAFE_OP(Compare)
|
||||
SAFE_OP(Phi)
|
||||
SAFE_OP(Beta)
|
||||
UNSAFE_OP(OsrValue)
|
||||
@ -492,30 +492,6 @@ ParallelArrayVisitor::visitTest(MTest *)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ParallelArrayVisitor::visitCompare(MCompare *compare)
|
||||
{
|
||||
MCompare::CompareType type = compare->compareType();
|
||||
|
||||
switch (type) {
|
||||
case MCompare::Compare_Int32:
|
||||
case MCompare::Compare_Double:
|
||||
case MCompare::Compare_Null:
|
||||
case MCompare::Compare_Undefined:
|
||||
case MCompare::Compare_Boolean:
|
||||
case MCompare::Compare_Object:
|
||||
case MCompare::Compare_Value:
|
||||
case MCompare::Compare_Unknown:
|
||||
case MCompare::Compare_String:
|
||||
// These paths through compare are ok in any mode.
|
||||
return true;
|
||||
|
||||
default:
|
||||
SpewMIR(compare, "unsafe compareType=%d\n", type);
|
||||
return markUnsafe();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ParallelArrayVisitor::convertToBailout(MBasicBlock *block, MInstruction *ins)
|
||||
{
|
||||
|
@ -310,7 +310,8 @@ ParStrictlyEqualImpl(ForkJoinSlice *slice, MutableHandleValue lhs, MutableHandle
|
||||
return ParLooselyEqualImpl<Equal>(slice, lhs, rhs, res);
|
||||
}
|
||||
|
||||
return TP_RETRY_SEQUENTIALLY;
|
||||
*res = false;
|
||||
return TP_SUCCESS;
|
||||
}
|
||||
|
||||
ParallelResult
|
||||
|
@ -146,10 +146,11 @@ function assertEqParallelArray(a, b) {
|
||||
} while (bump(iv));
|
||||
}
|
||||
|
||||
function assertParallelArrayModesEq(modes, acc, opFunction, cmpFunction) {
|
||||
function assertParallelArrayModesEq(modes, acc, opFunction, cmpFunction, expect) {
|
||||
if (!cmpFunction) { cmpFunction = assertStructuralEq; }
|
||||
if (!expect) { expect = "success"; }
|
||||
modes.forEach(function (mode) {
|
||||
var result = opFunction({ mode: mode, expect: "success" });
|
||||
var result = opFunction({ mode: mode, expect: expect });
|
||||
cmpFunction(acc, result);
|
||||
});
|
||||
}
|
||||
@ -177,7 +178,7 @@ function comparePerformance(opts) {
|
||||
}
|
||||
}
|
||||
|
||||
function compareAgainstArray(jsarray, opname, func, cmpFunction) {
|
||||
function compareAgainstArray(jsarray, opname, func, cmpFunction, expect) {
|
||||
var expected = jsarray[opname].apply(jsarray, [func]);
|
||||
var parray = new ParallelArray(jsarray);
|
||||
|
||||
@ -189,7 +190,7 @@ function compareAgainstArray(jsarray, opname, func, cmpFunction) {
|
||||
var result = parray[opname].apply(parray, [func, m]);
|
||||
// print(result.toString());
|
||||
return result;
|
||||
}, cmpFunction);
|
||||
}, cmpFunction, expect);
|
||||
}
|
||||
|
||||
function testFilter(jsarray, func, cmpFunction) {
|
||||
|
47
js/src/jit-test/tests/parallelarray/compare-values.js
Normal file
47
js/src/jit-test/tests/parallelarray/compare-values.js
Normal file
@ -0,0 +1,47 @@
|
||||
load(libdir + "parallelarray-helpers.js");
|
||||
|
||||
// Test that we are able to compare numbers even if the typesets are
|
||||
// not "clean" because we have previously added strings and numbers.
|
||||
// Also test that we distinguish between bools/numbers etc for strict
|
||||
// equality but not loose equality.
|
||||
|
||||
function theTest() {
|
||||
var ints = range(0, 1024);
|
||||
var doubles = ints.map(v => v + 0.1);
|
||||
var bools = ints.map(v => (v % 2) == 0);
|
||||
var strings = ints.map(v => String(v));
|
||||
|
||||
function looselyCompareToDoubles(e, i) {
|
||||
return doubles[i] == e;
|
||||
}
|
||||
print("doubles");
|
||||
compareAgainstArray(doubles, "map", looselyCompareToDoubles)
|
||||
print("bools");
|
||||
compareAgainstArray(bools, "map", looselyCompareToDoubles,
|
||||
assertStructuralEq, "mixed")
|
||||
// ion bails out when converting a string to a double right now,
|
||||
// so par exec cannot proceed
|
||||
print("strings");
|
||||
compareAgainstArray(strings, "map", looselyCompareToDoubles,
|
||||
assertStructuralEq, "disqualified")
|
||||
print("ints");
|
||||
compareAgainstArray(ints, "map", looselyCompareToDoubles)
|
||||
|
||||
function strictlyCompareToDoubles(e, i) {
|
||||
return doubles[i] === e;
|
||||
}
|
||||
print("doubles, strict");
|
||||
compareAgainstArray(doubles, "map", strictlyCompareToDoubles,
|
||||
assertStructuralEq, "mixed")
|
||||
print("bools, strict");
|
||||
compareAgainstArray(bools, "map", strictlyCompareToDoubles,
|
||||
assertStructuralEq, "mixed")
|
||||
print("strings, strict");
|
||||
compareAgainstArray(strings, "map", strictlyCompareToDoubles,
|
||||
assertStructuralEq, "mixed")
|
||||
print("ints, strict");
|
||||
compareAgainstArray(ints, "map", strictlyCompareToDoubles)
|
||||
}
|
||||
|
||||
if (getBuildConfiguration().parallelJS)
|
||||
theTest();
|
Loading…
Reference in New Issue
Block a user