Bug 1464134 part 6 - Replace AbstractFramePtr::compartment with AbstractFramePtr::realm. r=anba
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 30 May 2018 20:14:18 +0200
changeset 420487 e73059705526a72f917a5d3acb1a8aa90d1152d7
parent 420486 51748a8a2967a48721906dc0ba9cf3515146a22a
child 420488 24a0788bae5f6eb7ce189069e8a7a4b669ca2c4c
push id103824
push userjandemooij@gmail.com
push dateWed, 30 May 2018 18:19:26 +0000
treeherdermozilla-inbound@16106d1e0abd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1464134
milestone62.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 1464134 part 6 - Replace AbstractFramePtr::compartment with AbstractFramePtr::realm. r=anba
js/src/builtin/Eval.cpp
js/src/vm/EnvironmentObject.cpp
js/src/vm/SavedStacks.cpp
js/src/vm/Stack-inl.h
js/src/vm/Stack.h
--- a/js/src/builtin/Eval.cpp
+++ b/js/src/builtin/Eval.cpp
@@ -416,17 +416,17 @@ js::DirectEval(JSContext* cx, HandleValu
     // Direct eval can assume it was called from an interpreted or baseline frame.
     ScriptFrameIter iter(cx);
     AbstractFramePtr caller = iter.abstractFramePtr();
 
     MOZ_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL ||
                JSOp(*iter.pc()) == JSOP_STRICTEVAL ||
                JSOp(*iter.pc()) == JSOP_SPREADEVAL ||
                JSOp(*iter.pc()) == JSOP_STRICTSPREADEVAL);
-    MOZ_ASSERT(caller.compartment() == caller.script()->compartment());
+    MOZ_ASSERT(caller.realm() == caller.script()->realm());
 
     RootedObject envChain(cx, caller.environmentChain());
     return EvalKernel(cx, v, DIRECT_EVAL, caller, envChain, iter.pc(), vp);
 }
 
 bool
 js::IsAnyBuiltinEval(JSFunction* fun)
 {
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -2824,17 +2824,17 @@ DebugEnvironments::onPopVar(JSContext* c
         onPopGeneric<VarEnvironmentObject, EvalScope>(cx, ei);
     else
         onPopGeneric<VarEnvironmentObject, VarScope>(cx, ei);
 }
 
 void
 DebugEnvironments::onPopWith(AbstractFramePtr frame)
 {
-    Realm* realm = JS::GetRealmForCompartment(frame.compartment());
+    Realm* realm = frame.realm();
     if (DebugEnvironments* envs = realm->debugEnvs())
         envs->liveEnvs.remove(&frame.environmentChain()->as<WithEnvironmentObject>());
 }
 
 void
 DebugEnvironments::onRealmUnsetIsDebuggee(Realm* realm)
 {
     if (DebugEnvironments* envs = realm->debugEnvs()) {
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -1476,17 +1476,17 @@ SavedStacks::insertFrames(JSContext* cx,
         {
             AutoRealmUnchecked ar(cx, iter.realm());
             if (!cx->realm()->savedStacks().getLocation(cx, iter, &location))
                 return false;
         }
 
         RootedAtom displayAtom(cx, iter.maybeFunctionDisplayAtom());
 
-        auto principals = JS::GetRealmForCompartment(iter.compartment())->principals();
+        auto principals = iter.realm()->principals();
         MOZ_ASSERT_IF(framePtr && !iter.isWasm(), iter.pc());
 
         if (!stackChain->emplaceBack(location.source(),
                                      location.line(),
                                      location.column(),
                                      displayAtom,
                                      nullptr, // asyncCause
                                      nullptr, // parent (not known yet)
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -488,20 +488,20 @@ AbstractFramePtr::initFunctionEnvironmen
 }
 
 inline bool
 AbstractFramePtr::pushVarEnvironment(JSContext* cx, HandleScope scope)
 {
     return js::PushVarEnvironmentObject(cx, scope, *this);
 }
 
-inline JSCompartment*
-AbstractFramePtr::compartment() const
+inline JS::Realm*
+AbstractFramePtr::realm() const
 {
-    return environmentChain()->compartment();
+    return environmentChain()->realm();
 }
 
 inline unsigned
 AbstractFramePtr::numActualArgs() const
 {
     if (isInterpreterFrame())
         return asInterpreterFrame()->numActualArgs();
     if (isBaselineFrame())
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -210,17 +210,17 @@ class AbstractFramePtr
     inline CallObject& callObj() const;
     inline bool initFunctionEnvironmentObjects(JSContext* cx);
     inline bool pushVarEnvironment(JSContext* cx, HandleScope scope);
     template <typename SpecificEnvironment>
     inline void pushOnEnvironmentChain(SpecificEnvironment& env);
     template <typename SpecificEnvironment>
     inline void popOffEnvironmentChain();
 
-    inline JSCompartment* compartment() const;
+    inline JS::Realm* realm() const;
 
     inline bool hasInitialEnvironment() const;
     inline bool isGlobalFrame() const;
     inline bool isModuleFrame() const;
     inline bool isEvalFrame() const;
     inline bool isDebuggerEvalFrame() const;
 
     inline bool hasScript() const;