Bug 1281385 - Cache the needsCallObject bit in CompileInfo to fix a TSan race. r=nbp

This commit is contained in:
Jan de Mooij 2016-06-30 08:32:39 +02:00
parent 3213a7983d
commit 8806e32742

View File

@ -225,12 +225,13 @@ class CompileInfo
fixedLexicalBegin_ = script->fixedLexicalBegin();
nstack_ = Max<unsigned>(script->nslots() - script->nfixed(), MinJITStackSize);
nslots_ = nimplicit_ + nargs_ + nlocals_ + nstack_;
needsCallObject_ = fun ? fun->needsCallObject() : false;
}
explicit CompileInfo(unsigned nlocals)
: script_(nullptr), fun_(nullptr), osrPc_(nullptr), osrStaticScope_(nullptr),
constructing_(false), analysisMode_(Analysis_None), scriptNeedsArgsObj_(false),
mayReadFrameArgsDirectly_(false), inlineScriptTree_(nullptr)
constructing_(false), needsCallObject_(false), analysisMode_(Analysis_None),
scriptNeedsArgsObj_(false), mayReadFrameArgsDirectly_(false), inlineScriptTree_(nullptr)
{
nimplicit_ = 0;
nargs_ = 0;
@ -329,6 +330,10 @@ class CompileInfo
unsigned nargs() const {
return nargs_;
}
bool needsCallObject() const {
MOZ_ASSERT(funMaybeLazy());
return needsCallObject_;
}
// Number of slots needed for fixed body-level bindings. Note that this
// is only non-zero for function code.
unsigned nbodyfixed() const {
@ -499,7 +504,7 @@ class CompileInfo
if (slot == thisSlot())
return true;
if (funMaybeLazy()->needsCallObject() && slot == scopeChainSlot())
if (needsCallObject() && slot == scopeChainSlot())
return true;
// If the function may need an arguments object, then make sure to
@ -572,6 +577,7 @@ class CompileInfo
jsbytecode* osrPc_;
NestedStaticScope* osrStaticScope_;
bool constructing_;
bool needsCallObject_;
AnalysisMode analysisMode_;
// Whether a script needs an arguments object is unstable over compilation