Bug 832373 part 1 - Refactor eval-in-frame to use AbstractFramePtr. r=luke

This commit is contained in:
Jan de Mooij
2013-01-21 13:58:50 +01:00
parent e9d8665d0d
commit e3b25473f4
16 changed files with 390 additions and 273 deletions

View File

@@ -47,7 +47,7 @@ SetSourceMap(JSContext *cx, TokenStream &tokenStream, ScriptSource *ss, Unrooted
}
UnrootedScript
frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *callerFrame,
frontend::CompileScript(JSContext *cx, HandleObject scopeChain, AbstractFramePtr callerFrame,
const CompileOptions &options,
StableCharPtr chars, size_t length,
JSString *source_ /* = NULL */,
@@ -106,7 +106,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
if (!pc.init())
return UnrootedScript(NULL);
bool savedCallerFun = options.compileAndGo && callerFrame && callerFrame->isFunctionFrame();
bool savedCallerFun = options.compileAndGo && callerFrame && callerFrame.isFunctionFrame();
Rooted<JSScript*> script(cx, JSScript::Create(cx, NullPtr(), savedCallerFun,
options, staticLevel, ss, 0, length));
if (!script)
@@ -129,7 +129,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
return UnrootedScript(NULL);
/* If this is a direct call to eval, inherit the caller's strictness. */
if (callerFrame && callerFrame->script()->strict)
if (callerFrame && callerFrame.script()->strict)
globalsc.strict = true;
if (options.compileAndGo) {
@@ -144,13 +144,13 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
return UnrootedScript(NULL);
}
if (callerFrame && callerFrame->isFunctionFrame()) {
if (callerFrame && callerFrame.isFunctionFrame()) {
/*
* An eval script in a caller frame needs to have its enclosing
* function captured in case it refers to an upvar, and someone
* wishes to decompile it while it's running.
*/
JSFunction *fun = callerFrame->fun();
JSFunction *fun = callerFrame.fun();
ObjectBox *funbox = parser.newFunctionBox(fun, &pc, fun->strict());
if (!funbox)
return UnrootedScript(NULL);
@@ -217,7 +217,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
#endif
// It's an error to use |arguments| in a function that has a rest parameter.
if (callerFrame && callerFrame->isFunctionFrame() && callerFrame->fun()->hasRest()) {
if (callerFrame && callerFrame.isFunctionFrame() && callerFrame.fun()->hasRest()) {
HandlePropertyName arguments = cx->names().arguments;
for (AtomDefnRange r = pc.lexdeps->all(); !r.empty(); r.popFront()) {
if (r.front().key() == arguments) {
@@ -318,7 +318,8 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
return false;
}
BytecodeEmitter funbce(/* parent = */ NULL, &parser, funbox, script, /* callerFrame = */ NULL,
BytecodeEmitter funbce(/* parent = */ NULL, &parser, funbox, script,
/* callerFrame = */ NullFramePtr(),
/* hasGlobalScope = */ false, options.lineno);
if (!funbce.init())
return false;