Bug 690446 - Emit *GNAME ops in non-eval strict-mode code. r=bhackett

This commit is contained in:
Jan de Mooij
2013-05-07 16:27:14 +02:00
parent bc31549c32
commit 15adc8da03
8 changed files with 32 additions and 16 deletions

View File

@@ -90,6 +90,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain,
* and non-zero static level requires callerFrame.
*/
JS_ASSERT_IF(evalCaller, options.compileAndGo);
JS_ASSERT_IF(evalCaller, options.forEval);
JS_ASSERT_IF(staticLevel != 0, evalCaller);
if (!CheckLength(cx, length))
@@ -146,8 +147,8 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain,
JS_ASSERT_IF(globalScope, globalScope->isNative());
JS_ASSERT_IF(globalScope, JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(globalScope->getClass()));
BytecodeEmitter bce(/* parent = */ NULL, &parser, &globalsc, script, evalCaller, !!globalScope,
options.lineno, options.selfHostingMode);
BytecodeEmitter bce(/* parent = */ NULL, &parser, &globalsc, script, options.forEval, evalCaller,
!!globalScope, options.lineno, options.selfHostingMode);
if (!bce.init())
return NULL;
@@ -330,6 +331,8 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
return false;
}
JS_ASSERT(!options.forEval);
Parser<FullParseHandler> parser(cx, options, chars, length, /* foldConstants = */ true);
if (!parser.init())
return false;
@@ -420,7 +423,7 @@ frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, CompileO
* is cloned immediately onto the right scope chain.
*/
BytecodeEmitter funbce(/* parent = */ NULL, &parser, funbox, script,
/* evalCaller = */ NullPtr(),
/* insideEval = */ false, /* evalCaller = */ NullPtr(),
fun->environment() && fun->environment()->isGlobal(),
options.lineno);
if (!funbce.init())