зеркало из https://github.com/mozilla/pjs.git
Move GlobalScope from BytecodeCompiler to BytecodeEmitter. Bug 696953, part 2 of 4. r=Waldo.
--HG-- rename : js/src/frontend/Parser.cpp => js/src/frontend/SemanticAnalysis.cpp extra : rebase_source : d07f9e50246b46d9704c3a45ae0fa368c88319be
This commit is contained in:
Родитель
fb03c1e783
Коммит
a29b6396bb
|
@ -55,7 +55,7 @@ using namespace js::frontend;
|
|||
* Compile a top-level script.
|
||||
*/
|
||||
BytecodeCompiler::BytecodeCompiler(JSContext *cx, JSPrincipals *prin, StackFrame *cfp)
|
||||
: parser(cx, prin, cfp), globalScope(NULL)
|
||||
: parser(cx, prin, cfp)
|
||||
{}
|
||||
|
||||
JSScript *
|
||||
|
@ -110,7 +110,7 @@ BytecodeCompiler::compileScript(JSContext *cx, JSObject *scopeChain, StackFrame
|
|||
GlobalScope globalScope(cx, globalObj, &bce);
|
||||
bce.flags |= tcflags;
|
||||
bce.setScopeChain(scopeChain);
|
||||
compiler.globalScope = &globalScope;
|
||||
bce.globalScope = &globalScope;
|
||||
if (!SetStaticLevel(&bce, staticLevel))
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ namespace js {
|
|||
struct BytecodeCompiler
|
||||
{
|
||||
Parser parser;
|
||||
GlobalScope *globalScope;
|
||||
|
||||
BytecodeCompiler(JSContext *cx, JSPrincipals *prin = NULL, StackFrame *cfp = NULL);
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ BytecodeEmitter::BytecodeEmitter(Parser *parser, uintN lineno)
|
|||
constList(parser->context),
|
||||
upvarIndices(parser->context),
|
||||
upvarMap(parser->context),
|
||||
globalScope(NULL),
|
||||
globalUses(parser->context),
|
||||
globalMap(parser->context),
|
||||
closedArgs(parser->context),
|
||||
|
@ -2076,7 +2077,7 @@ static bool
|
|||
TryConvertToGname(BytecodeEmitter *bce, ParseNode *pn, JSOp *op)
|
||||
{
|
||||
if (bce->compileAndGo() &&
|
||||
bce->compiler()->globalScope->globalObj &&
|
||||
bce->globalScope->globalObj &&
|
||||
!bce->mightAliasLocals() &&
|
||||
!pn->isDeoptimized() &&
|
||||
!(bce->flags & TCF_STRICT_MODE_CODE)) {
|
||||
|
@ -2110,7 +2111,7 @@ BindKnownGlobal(JSContext *cx, BytecodeEmitter *bce, ParseNode *dn, ParseNode *p
|
|||
if (bce->mightAliasLocals())
|
||||
return true;
|
||||
|
||||
GlobalScope *globalScope = bce->compiler()->globalScope;
|
||||
GlobalScope *globalScope = bce->globalScope;
|
||||
|
||||
jsatomid index;
|
||||
if (dn->pn_cookie.isFree()) {
|
||||
|
@ -5923,6 +5924,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||
bce2->setFunction(fun);
|
||||
bce2->funbox = pn->pn_funbox;
|
||||
bce2->parent = bce;
|
||||
bce2->globalScope = bce->globalScope;
|
||||
|
||||
/*
|
||||
* js::frontend::SetStaticLevel limited static nesting depth to fit in
|
||||
|
|
|
@ -435,8 +435,6 @@ struct TreeContext { /* tree context for semantic checks */
|
|||
int sharpSlotBase;
|
||||
bool ensureSharpSlots();
|
||||
|
||||
BytecodeCompiler *compiler() { return (BytecodeCompiler *) parser; }
|
||||
|
||||
// Return true there is a generator function within |skip| lexical scopes
|
||||
// (going upward) from this context's lexical scope. Always return true if
|
||||
// this context is itself a generator.
|
||||
|
@ -657,6 +655,8 @@ struct BytecodeEmitter : public TreeContext
|
|||
|
||||
UpvarCookies upvarMap; /* indexed upvar slot locations */
|
||||
|
||||
GlobalScope *globalScope; /* frontend::CompileScript global scope, or null */
|
||||
|
||||
typedef Vector<GlobalSlotArray::Entry, 16> GlobalUseVector;
|
||||
|
||||
GlobalUseVector globalUses; /* per-script global uses */
|
||||
|
|
|
@ -2021,7 +2021,7 @@ OuterLet(TreeContext *tc, StmtInfo *stmt, JSAtom *atom)
|
|||
static bool
|
||||
DefineGlobal(ParseNode *pn, BytecodeEmitter *bce, PropertyName *name)
|
||||
{
|
||||
GlobalScope *globalScope = bce->compiler()->globalScope;
|
||||
GlobalScope *globalScope = bce->globalScope;
|
||||
JSObject *globalObj = globalScope->globalObj;
|
||||
|
||||
if (!bce->compileAndGo() || !globalObj || bce->compilingForEval())
|
||||
|
|
Загрузка…
Ссылка в новой задаче