Skip to content

Commit

Permalink
Bug 1610340 - Remove dead Scope::create methods r=tcampbell
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D60461

--HG--
extra : moz-landing-system : lando
  • Loading branch information
mgaudet committed Jan 21, 2020
1 parent 2146b82 commit af08f70
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 106 deletions.
88 changes: 0 additions & 88 deletions js/src/vm/Scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,23 +538,6 @@ uint32_t LexicalScope::nextFrameSlot(const AbstractScope& scope) {
MOZ_CRASH("Not an enclosing intra-frame Scope");
}

/* static */
LexicalScope* LexicalScope::create(JSContext* cx, ScopeKind kind,
Handle<Data*> data, uint32_t firstFrameSlot,
HandleScope enclosing) {
MOZ_ASSERT(data,
"LexicalScopes should not be created if there are no bindings.");

// The data that's passed in is from the frontend and is LifoAlloc'd.
// Copy it now that we're creating a permanent VM scope.
Rooted<UniquePtr<Data>> copy(cx, CopyScopeData<LexicalScope>(cx, data));
if (!copy) {
return nullptr;
}

return createWithData(cx, kind, &copy, firstFrameSlot, enclosing);
}

bool LexicalScope::prepareForScopeCreation(JSContext* cx, ScopeKind kind,
uint32_t firstFrameSlot,
Handle<AbstractScope> enclosing,
Expand Down Expand Up @@ -666,26 +649,6 @@ static inline uint32_t FunctionScopeEnvShapeFlags(bool hasParameterExprs) {
return BaseShape::QUALIFIED_VAROBJ | BaseShape::DELEGATE;
}

/* static */
FunctionScope* FunctionScope::create(JSContext* cx, Handle<Data*> dataArg,
bool hasParameterExprs,
bool needsEnvironment, HandleFunction fun,
HandleScope enclosing) {
// The data that's passed in is from the frontend and is LifoAlloc'd.
// Copy it now that we're creating a permanent VM scope.
Rooted<UniquePtr<Data>> data(
cx, dataArg ? CopyScopeData<FunctionScope>(cx, dataArg)
: NewEmptyScopeData<FunctionScope>(cx));
if (!data) {
return nullptr;
}

return createWithData(
cx, &data, hasParameterExprs,
dataArg ? dataArg->isFieldInitializer : IsFieldInitializer::No,
needsEnvironment, fun, enclosing);
}

bool FunctionScope::prepareForScopeCreation(
JSContext* cx, MutableHandle<UniquePtr<Data>> data, bool hasParameterExprs,
IsFieldInitializer isFieldInitializer, bool needsEnvironment,
Expand Down Expand Up @@ -867,23 +830,6 @@ static UniquePtr<VarScope::Data> NewEmptyVarScopeData(JSContext* cx,
return data;
}

/* static */
VarScope* VarScope::create(JSContext* cx, ScopeKind kind, Handle<Data*> dataArg,
uint32_t firstFrameSlot, bool needsEnvironment,
HandleScope enclosing) {
// The data that's passed in is from the frontend and is LifoAlloc'd.
// Copy it now that we're creating a permanent VM scope.
Rooted<UniquePtr<Data>> data(
cx, dataArg ? CopyScopeData<VarScope>(cx, dataArg)
: NewEmptyVarScopeData(cx, firstFrameSlot));
if (!data) {
return nullptr;
}

return createWithData(cx, kind, &data, firstFrameSlot, needsEnvironment,
enclosing);
}

bool VarScope::prepareForScopeCreation(JSContext* cx, ScopeKind kind,
MutableHandle<UniquePtr<Data>> data,
uint32_t firstFrameSlot,
Expand Down Expand Up @@ -1119,21 +1065,6 @@ template
static const uint32_t EvalScopeEnvShapeFlags =
BaseShape::QUALIFIED_VAROBJ | BaseShape::DELEGATE;

/* static */
EvalScope* EvalScope::create(JSContext* cx, ScopeKind scopeKind,
Handle<Data*> dataArg, HandleScope enclosing) {
// The data that's passed in is from the frontend and is LifoAlloc'd.
// Copy it now that we're creating a permanent VM scope.
Rooted<UniquePtr<Data>> data(cx, dataArg
? CopyScopeData<EvalScope>(cx, dataArg)
: NewEmptyScopeData<EvalScope>(cx));
if (!data) {
return nullptr;
}

return createWithData(cx, scopeKind, &data, enclosing);
}

bool EvalScope::prepareForScopeCreation(JSContext* cx, ScopeKind scopeKind,
MutableHandle<UniquePtr<Data>> data,
MutableHandleShape envShape) {
Expand Down Expand Up @@ -1244,25 +1175,6 @@ Zone* ModuleScope::Data::zone() const {
return module ? module->zone() : nullptr;
}

/* static */
ModuleScope* ModuleScope::create(JSContext* cx, Handle<Data*> dataArg,
HandleModuleObject module,
HandleScope enclosing) {
// ModuleScope::Data has GCManagedDeletePolicy because it contains a
// GCPtr. Destruction of |data| below may trigger calls into the GC.

// The data that's passed in is from the frontend and is LifoAlloc'd.
// Copy it now that we're creating a permanent VM scope.
Rooted<UniquePtr<Data>> data(cx, dataArg
? CopyScopeData<ModuleScope>(cx, dataArg)
: NewEmptyScopeData<ModuleScope>(cx));
if (!data) {
return nullptr;
}

return createWithData(cx, &data, module, enclosing);
}

/* static */
bool ModuleScope::prepareForScopeCreation(JSContext* cx,
MutableHandle<UniquePtr<Data>> data,
Expand Down
18 changes: 0 additions & 18 deletions js/src/vm/Scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,6 @@ class LexicalScope : public Scope {
void trace(JSTracer* trc);
};

static LexicalScope* create(JSContext* cx, ScopeKind kind, Handle<Data*> data,
uint32_t firstFrameSlot, HandleScope enclosing);

template <XDRMode mode>
static XDRResult XDR(XDRState<mode>* xdr, ScopeKind kind,
HandleScope enclosing, MutableHandleScope scope);
Expand Down Expand Up @@ -552,10 +549,6 @@ class FunctionScope : public Scope {
void trace(JSTracer* trc);
};

static FunctionScope* create(JSContext* cx, Handle<Data*> data,
bool hasParameterExprs, bool needsEnvironment,
HandleFunction fun, HandleScope enclosing);

static bool prepareForScopeCreation(JSContext* cx,
MutableHandle<UniquePtr<Data>> data,
bool hasParameterExprs,
Expand Down Expand Up @@ -649,10 +642,6 @@ class VarScope : public Scope {
void trace(JSTracer* trc);
};

static VarScope* create(JSContext* cx, ScopeKind kind, Handle<Data*> data,
uint32_t firstFrameSlot, bool needsEnvironment,
HandleScope enclosing);

template <XDRMode mode>
static XDRResult XDR(XDRState<mode>* xdr, ScopeKind kind,
HandleScope enclosing, MutableHandleScope scope);
Expand Down Expand Up @@ -828,9 +817,6 @@ class EvalScope : public Scope {
void trace(JSTracer* trc);
};

static EvalScope* create(JSContext* cx, ScopeKind kind, Handle<Data*> data,
HandleScope enclosing);

template <XDRMode mode>
static XDRResult XDR(XDRState<mode>* xdr, ScopeKind kind,
HandleScope enclosing, MutableHandleScope scope);
Expand Down Expand Up @@ -922,10 +908,6 @@ class ModuleScope : public Scope {
Zone* zone() const;
};

static ModuleScope* create(JSContext* cx, Handle<Data*> data,
Handle<ModuleObject*> module,
HandleScope enclosing);

template <XDRMode mode>
static XDRResult XDR(XDRState<mode>* xdr, HandleModuleObject module,
HandleScope enclosing, MutableHandleScope scope);
Expand Down

0 comments on commit af08f70

Please sign in to comment.