Bug 1144743 part 1. Add a hasPollutedGlobalScope flag to scripts. r=luke

This commit is contained in:
Boris Zbarsky 2015-03-20 00:34:07 -04:00
Родитель 3c7aa89ef5
Коммит ccaabb9de0
3 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -576,7 +576,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
IsCompileAndGo,
HasSingleton,
TreatAsRunOnce,
HasLazyScript
HasLazyScript,
HasPollutedGlobalScope,
};
uint32_t length, lineno, column, nslots, staticLevel;
@ -694,6 +695,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
scriptBits |= (1 << TreatAsRunOnce);
if (script->isRelazifiable())
scriptBits |= (1 << HasLazyScript);
if (script->hasPollutedGlobalScope())
scriptBits |= (1 << HasPollutedGlobalScope);
}
if (!xdr->codeUint32(&prologLength))
@ -811,6 +814,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
script->hasSingletons_ = true;
if (scriptBits & (1 << TreatAsRunOnce))
script->treatAsRunOnce_ = true;
if (scriptBits & (1 << HasPollutedGlobalScope))
script->hasPollutedGlobalScope_ = true;
if (scriptBits & (1 << IsLegacyGenerator)) {
MOZ_ASSERT(!(scriptBits & (1 << IsStarGenerator)));

Просмотреть файл

@ -918,6 +918,11 @@ class JSScript : public js::gc::TenuredCell
// See Parser::compileAndGo.
bool compileAndGo_:1;
// True if the script has a non-syntactic scope on its dynamic scope chain.
// That is, there are objects about which we know nothing between the
// outermost syntactic scope and the global.
bool hasPollutedGlobalScope_:1;
// see Parser::selfHostingMode.
bool selfHosted_:1;
@ -1143,6 +1148,10 @@ class JSScript : public js::gc::TenuredCell
return compileAndGo_;
}
bool hasPollutedGlobalScope() const {
return hasPollutedGlobalScope_;
}
bool selfHosted() const { return selfHosted_; }
bool bindingsAccessedDynamically() const { return bindingsAccessedDynamically_; }
bool funHasExtensibleScope() const {

Просмотреть файл

@ -29,7 +29,7 @@ namespace js {
*
* https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/Bytecode
*/
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 259;
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 260;
static const uint32_t XDR_BYTECODE_VERSION =
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);