Bug 679939 part 5. Stop using the compileAndGo script flag in the bytecode emitter. r=luke

This commit is contained in:
Boris Zbarsky 2015-04-01 12:05:29 -04:00
parent c2eaf2205f
commit 0552083636
3 changed files with 15 additions and 8 deletions

View File

@ -1680,7 +1680,7 @@ BytecodeEmitter::bindNameToSlotHelper(ParseNode* pn)
if (dn->pn_cookie.isFree()) {
if (evalCaller) {
MOZ_ASSERT(script->compileAndGo());
MOZ_ASSERT(script->treatAsRunOnce() || sc->isFunctionBox());
/*
* Don't generate upvars on the left side of a for loop. See
@ -2073,12 +2073,18 @@ BytecodeEmitter::isInLoop()
bool
BytecodeEmitter::checkSingletonContext()
{
if (!script->compileAndGo() || sc->isFunctionBox() || isInLoop())
if (!script->treatAsRunOnce() || sc->isFunctionBox() || isInLoop())
return false;
hasSingletons = true;
return true;
}
bool
BytecodeEmitter::checkRunOnceContext()
{
return checkSingletonContext() || (!isInLoop() && isRunOnceLambda());
}
bool
BytecodeEmitter::needsImplicitThis()
{
@ -5194,10 +5200,7 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
* make a deep clone of its contents.
*/
if (fun->isInterpreted()) {
bool singleton =
script->compileAndGo() &&
fun->isInterpreted() &&
(checkSingletonContext() || (!isInLoop() && isRunOnceLambda()));
bool singleton = checkRunOnceContext();
if (!JSFunction::setTypeForScriptedFunction(cx, fun, singleton))
return false;
@ -6088,7 +6091,7 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn)
* will just cause the inner scripts to be repeatedly cloned.
*/
MOZ_ASSERT(!emittingRunOnceLambda);
if (checkSingletonContext() || (!isInLoop() && isRunOnceLambda())) {
if (checkRunOnceContext()) {
emittingRunOnceLambda = true;
if (!emitTree(pn2))
return false;

View File

@ -248,6 +248,10 @@ struct BytecodeEmitter
bool isInLoop();
bool checkSingletonContext();
// Check whether our function is in a run-once context (a toplevel
// run-one script or a run-once lambda).
bool checkRunOnceContext();
bool needsImplicitThis();
void tellDebuggerAboutCompiledScript(ExclusiveContext* cx);

View File

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