From 9019492a10f2dbfc8d88a8df1bc128beeee27b91 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 20 Mar 2015 00:34:08 -0400 Subject: [PATCH] Bug 1144802 part 8. Drop the scopechain member from GlobalSharedContext, since it's not needed anymore. r=luke --- js/src/frontend/BytecodeCompiler.cpp | 2 +- js/src/frontend/Parser.cpp | 2 +- js/src/frontend/SharedContext.h | 18 ++---------------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 2aade16f916..b1be2c877ae 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -283,7 +283,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco return nullptr; Directives directives(options.strictOption); - GlobalSharedContext globalsc(cx, scopeChain, directives, options.extraWarningsOption); + GlobalSharedContext globalsc(cx, directives, options.extraWarningsOption); bool savedCallerFun = evalCaller && evalCaller->functionOrCallerFunction(); Rooted script(cx, JSScript::Create(cx, evalStaticScope, savedCallerFun, diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 254c48cc813..971c1854d41 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -699,7 +699,7 @@ Parser::parse(JSObject *chain) * protected from the GC by a root or a stack frame reference. */ Directives directives(options().strictOption); - GlobalSharedContext globalsc(context, chain, directives, options().extraWarningsOption); + GlobalSharedContext globalsc(context, directives, options().extraWarningsOption); ParseContext globalpc(this, /* parent = */ nullptr, ParseHandler::null(), &globalsc, /* newDirectives = */ nullptr, /* staticLevel = */ 0, /* bodyid = */ 0, diff --git a/js/src/frontend/SharedContext.h b/js/src/frontend/SharedContext.h index 3857e14c599..f0101bb0d8c 100644 --- a/js/src/frontend/SharedContext.h +++ b/js/src/frontend/SharedContext.h @@ -193,9 +193,7 @@ class SharedContext {} virtual ObjectBox *toObjectBox() = 0; - inline bool isGlobalSharedContext() { return toObjectBox() == nullptr; } inline bool isFunctionBox() { return toObjectBox() && toObjectBox()->isFunctionBox(); } - inline GlobalSharedContext *asGlobalSharedContext(); inline FunctionBox *asFunctionBox(); bool hasExplicitUseStrict() const { return anyCxFlags.hasExplicitUseStrict; } @@ -231,27 +229,15 @@ class SharedContext class GlobalSharedContext : public SharedContext { - private: - const RootedObject scopeChain_; /* scope chain object for the script */ - public: - GlobalSharedContext(ExclusiveContext *cx, JSObject *scopeChain, + GlobalSharedContext(ExclusiveContext *cx, Directives directives, bool extraWarnings) - : SharedContext(cx, directives, extraWarnings), - scopeChain_(cx, scopeChain) + : SharedContext(cx, directives, extraWarnings) {} ObjectBox *toObjectBox() { return nullptr; } - JSObject *scopeChain() const { return scopeChain_; } }; -inline GlobalSharedContext * -SharedContext::asGlobalSharedContext() -{ - MOZ_ASSERT(isGlobalSharedContext()); - return static_cast(this); -} - class FunctionBox : public ObjectBox, public SharedContext { public: