mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1231163 - Don't assume the RNG's been initialized by a prior call to Math.random, when a call to Math.random is being inlined. (A method can be inlined once its identity has been guarded against, but mere identity can be established without the method having been called.) r=jwalden
This commit is contained in:
parent
a10668eec6
commit
32ab0e4a93
@ -0,0 +1,11 @@
|
||||
// |jit-test| ion-eager
|
||||
|
||||
function ionCompiledEagerly() {
|
||||
Math.random; // establish Math.random's identity for inlining
|
||||
return function() {
|
||||
return +Math.random(); // call will be inlined
|
||||
};
|
||||
}
|
||||
|
||||
var alreadyIonCompiled = ionCompiledEagerly();
|
||||
assertEq(alreadyIonCompiled() < 1, true);
|
@ -1360,8 +1360,10 @@ IonBuilder::inlineMathRandom(CallInfo& callInfo)
|
||||
if (getInlineReturnType() != MIRType_Double)
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
MOZ_ASSERT(script()->compartment()->randomNumberGenerator.isSome(),
|
||||
"MRandom JIT code depends on RNG being initialized");
|
||||
// MRandom JIT code directly accesses the RNG. It's (barely) possible to
|
||||
// inline Math.random without it having been called yet, so ensure RNG
|
||||
// state that isn't guaranteed to be initialized already.
|
||||
script()->compartment()->ensureRandomNumberGenerator();
|
||||
|
||||
callInfo.setImplicitlyUsedUnchecked();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user