Bug 1221144 - Part 12: Remove StaticScopeIter<>::IsStaticScope. r=shu.
authorJason Orendorff <jorendorff@mozilla.com>
Thu, 12 Nov 2015 15:29:38 -0600
changeset 319321 c0f21d3e4eb5bea3b882e53c14a8ec9165b69673
parent 319320 90ea0e5db89f1b5b283d9d29bcf0110dd8a6c413
child 319322 4033253f5d7fc44668ede75ba945e492b6ac316a
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1221144
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1221144 - Part 12: Remove StaticScopeIter<>::IsStaticScope. r=shu. (Jeff beat me to the code cleanup that was part 11.) JSObject::is<StaticScope>() now means the same thing. We retain a few assertions that were using IsStaticScope(), even though the work in this bug makes it unlikely these assertions will ever fail again.
js/src/vm/ScopeObject-inl.h
js/src/vm/ScopeObject.h
--- a/js/src/vm/ScopeObject-inl.h
+++ b/js/src/vm/ScopeObject-inl.h
@@ -87,17 +87,17 @@ StaticScopeIter<allowGC>::operator++(int
     if (!scope->template is<StaticFunctionScope>()) {
         scope = scope->enclosingScope();
     } else if (onNamedLambda || !scope->template as<StaticFunctionScope>().isNamedLambda()) {
         onNamedLambda = false;
         scope = scope->enclosingScope();
     } else {
         onNamedLambda = true;
     }
-    MOZ_ASSERT_IF(scope, IsStaticScope(scope));
+    MOZ_ASSERT_IF(scope, scope->template is<StaticScope>());
     MOZ_ASSERT_IF(onNamedLambda, scope->template is<StaticFunctionScope>());
 }
 
 template <AllowGC allowGC>
 inline bool
 StaticScopeIter<allowGC>::hasSyntacticDynamicScopeObject() const
 {
     if (scope->template is<StaticFunctionScope>()) {
--- a/js/src/vm/ScopeObject.h
+++ b/js/src/vm/ScopeObject.h
@@ -492,48 +492,39 @@ class StaticNonSyntacticScope : public S
 };
 
 template <AllowGC allowGC>
 class StaticScopeIter
 {
     typename MaybeRooted<StaticScope*, allowGC>::RootType scope;
     bool onNamedLambda;
 
-    static bool IsStaticScope(JSObject* obj) {
-        return obj->is<StaticBlockScope>() ||
-               obj->is<StaticFunctionScope>() ||
-               obj->is<StaticModuleScope>() ||
-               obj->is<StaticWithScope>() ||
-               obj->is<StaticEvalScope>() ||
-               obj->is<StaticNonSyntacticScope>();
-    }
-
   public:
     StaticScopeIter(ExclusiveContext* cx, StaticScope* scope)
       : scope(cx, scope), onNamedLambda(false)
     {
         static_assert(allowGC == CanGC,
                       "the context-accepting constructor should only be used "
                       "in CanGC code");
-        MOZ_ASSERT_IF(scope, IsStaticScope(scope));
+        MOZ_ASSERT_IF(scope, scope->is<StaticScope>());
     }
 
     StaticScopeIter(ExclusiveContext* cx, const StaticScopeIter<CanGC>& ssi)
       : scope(cx, ssi.scope), onNamedLambda(ssi.onNamedLambda)
     {
         JS_STATIC_ASSERT(allowGC == CanGC);
     }
 
     explicit StaticScopeIter(StaticScope* scope)
       : scope((ExclusiveContext*) nullptr, scope), onNamedLambda(false)
     {
         static_assert(allowGC == NoGC,
                       "the constructor not taking a context should only be "
                       "used in NoGC code");
-        MOZ_ASSERT_IF(scope, IsStaticScope(scope));
+        MOZ_ASSERT_IF(scope, scope->is<StaticScope>());
     }
 
     explicit StaticScopeIter(const StaticScopeIter<NoGC>& ssi)
       : scope((ExclusiveContext*) nullptr, ssi.scope), onNamedLambda(ssi.onNamedLambda)
     {
         static_assert(allowGC == NoGC,
                       "the constructor not taking a context should only be "
                       "used in NoGC code");