Bug 1603406 - Part 11: Unused Stack functions. r=mgaudet
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 12 Dec 2019 16:44:49 +0000
changeset 506879 4d34599c5b9973980ff9128c8b65045414314bb0
parent 506878 f9b19065b5a7b325ad3389b9734d498ccdf23697
child 506880 679db0122024db925b0c2b20f86b83999e52d2c4
push id36913
push useropoprus@mozilla.com
push dateFri, 13 Dec 2019 16:53:24 +0000
treeherdermozilla-central@1ed684598bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1603406
milestone73.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 1603406 - Part 11: Unused Stack functions. r=mgaudet Depends on D56899 Differential Revision: https://phabricator.services.mozilla.com/D56900
js/src/jit/BaselineFrame.cpp
js/src/jit/BaselineFrame.h
js/src/vm/Stack-inl.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
--- a/js/src/jit/BaselineFrame.cpp
+++ b/js/src/jit/BaselineFrame.cpp
@@ -95,21 +95,16 @@ void BaselineFrame::trace(JSTracer* trc,
     TraceLocals(this, trc, 0, nlivefixed);
   }
 
   if (auto* debugEnvs = script->realm()->debugEnvs()) {
     debugEnvs->traceLiveFrame(trc, this);
   }
 }
 
-bool BaselineFrame::isNonGlobalEvalFrame() const {
-  return isEvalFrame() &&
-         script()->enclosingScope()->as<EvalScope>().isNonGlobal();
-}
-
 bool BaselineFrame::initFunctionEnvironmentObjects(JSContext* cx) {
   return js::InitFunctionEnvironmentObjects(cx, this);
 }
 
 bool BaselineFrame::pushVarEnvironment(JSContext* cx, HandleScope scope) {
   return js::PushVarEnvironmentObject(cx, scope, this);
 }
 
--- a/js/src/jit/BaselineFrame.h
+++ b/js/src/jit/BaselineFrame.h
@@ -338,24 +338,16 @@ class BaselineFrame {
   void setIsDebuggee() { flags_ |= DEBUGGEE; }
   inline void unsetIsDebuggee();
 
   void trace(JSTracer* trc, const JSJitFrameIter& frame);
 
   bool isGlobalFrame() const { return script()->isGlobalCode(); }
   bool isModuleFrame() const { return script()->isModule(); }
   bool isEvalFrame() const { return script()->isForEval(); }
-  bool isStrictEvalFrame() const { return isEvalFrame() && script()->strict(); }
-  bool isNonStrictEvalFrame() const {
-    return isEvalFrame() && !script()->strict();
-  }
-  bool isNonGlobalEvalFrame() const;
-  bool isNonStrictDirectEvalFrame() const {
-    return isNonStrictEvalFrame() && isNonGlobalEvalFrame();
-  }
   bool isFunctionFrame() const { return CalleeTokenIsFunction(calleeToken()); }
   bool isDebuggerEvalFrame() const { return false; }
 
   JitFrameLayout* framePrefix() const {
     uint8_t* fp = (uint8_t*)this + Size() + FramePointerOffset;
     return (JitFrameLayout*)fp;
   }
 
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -31,20 +31,16 @@ namespace js {
 inline HandleObject InterpreterFrame::environmentChain() const {
   return HandleObject::fromMarkedLocation(&envChain_);
 }
 
 inline GlobalObject& InterpreterFrame::global() const {
   return script()->global();
 }
 
-inline JSObject& InterpreterFrame::varObj() const {
-  return GetVariablesObject(environmentChain());
-}
-
 inline LexicalEnvironmentObject&
 InterpreterFrame::extensibleLexicalEnvironment() const {
   return NearestEnclosingExtensibleLexicalEnvironment(environmentChain());
 }
 
 inline void InterpreterFrame::initCallFrame(InterpreterFrame* prev,
                                             jsbytecode* prevpc, Value* prevsp,
                                             JSFunction& callee,
@@ -659,38 +655,16 @@ inline bool AbstractFramePtr::isFunction
 inline bool AbstractFramePtr::isGeneratorFrame() const {
   if (!isFunctionFrame()) {
     return false;
   }
   JSScript* s = script();
   return s->isGenerator() || s->isAsync();
 }
 
-inline bool AbstractFramePtr::isNonStrictDirectEvalFrame() const {
-  if (isInterpreterFrame()) {
-    return asInterpreterFrame()->isNonStrictDirectEvalFrame();
-  }
-  if (isBaselineFrame()) {
-    return asBaselineFrame()->isNonStrictDirectEvalFrame();
-  }
-  MOZ_ASSERT(isRematerializedFrame());
-  return false;
-}
-
-inline bool AbstractFramePtr::isStrictEvalFrame() const {
-  if (isInterpreterFrame()) {
-    return asInterpreterFrame()->isStrictEvalFrame();
-  }
-  if (isBaselineFrame()) {
-    return asBaselineFrame()->isStrictEvalFrame();
-  }
-  MOZ_ASSERT(isRematerializedFrame());
-  return false;
-}
-
 inline Value* AbstractFramePtr::argv() const {
   if (isInterpreterFrame()) {
     return asInterpreterFrame()->argv();
   }
   if (isBaselineFrame()) {
     return asBaselineFrame()->argv();
   }
   return asRematerializedFrame()->argv();
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -78,20 +78,16 @@ void InterpreterFrame::initExecuteFrame(
     setIsDebuggee();
   }
 
 #ifdef DEBUG
   Debug_SetValueRangeToCrashOnTouch(&rval_, 1);
 #endif
 }
 
-bool InterpreterFrame::isNonGlobalEvalFrame() const {
-  return isEvalFrame() && script()->bodyScope()->as<EvalScope>().isNonGlobal();
-}
-
 ArrayObject* InterpreterFrame::createRestParameter(JSContext* cx) {
   MOZ_ASSERT(script()->hasRest());
   unsigned nformal = callee().nargs() - 1, nactual = numActualArgs();
   unsigned nrest = (nactual > nformal) ? nactual - nformal : 0;
   Value* restvp = argv() + nformal;
   return ObjectGroup::newArrayObject(cx, restvp, nrest, GenericObject,
                                      ObjectGroup::NewArrayKind::UnknownIndex);
 }
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -132,22 +132,16 @@ class AbstractFramePtr {
   }
 
   MOZ_IMPLICIT AbstractFramePtr(wasm::DebugFrame* fp)
       : ptr_(fp ? uintptr_t(fp) | Tag_WasmDebugFrame : 0) {
     static_assert(wasm::DebugFrame::Alignment >= TagMask, "aligned");
     MOZ_ASSERT_IF(fp, asWasmDebugFrame() == fp);
   }
 
-  static AbstractFramePtr FromRaw(void* raw) {
-    AbstractFramePtr frame;
-    frame.ptr_ = uintptr_t(raw);
-    return frame;
-  }
-
   bool isInterpreterFrame() const {
     return (ptr_ & TagMask) == Tag_InterpreterFrame;
   }
   InterpreterFrame* asInterpreterFrame() const {
     MOZ_ASSERT(isInterpreterFrame());
     InterpreterFrame* res = (InterpreterFrame*)(ptr_ & ~TagMask);
     MOZ_ASSERT(res);
     return res;
@@ -218,18 +212,16 @@ class AbstractFramePtr {
 
   inline bool isConstructing() const;
   inline Value newTarget() const;
 
   inline bool debuggerNeedsCheckPrimitiveReturn() const;
 
   inline bool isFunctionFrame() const;
   inline bool isGeneratorFrame() const;
-  inline bool isNonStrictDirectEvalFrame() const;
-  inline bool isStrictEvalFrame() const;
 
   inline unsigned numActualArgs() const;
   inline unsigned numFormalArgs() const;
 
   inline Value* argv() const;
 
   inline bool hasArgs() const;
   inline bool hasArgsObj() const;
@@ -421,30 +413,16 @@ class InterpreterFrame {
   bool isGlobalFrame() const { return script_->isGlobalCode(); }
 
   bool isModuleFrame() const { return script_->isModule(); }
 
   bool isEvalFrame() const { return script_->isForEval(); }
 
   bool isFunctionFrame() const { return script_->isFunction(); }
 
-  inline bool isStrictEvalFrame() const {
-    return isEvalFrame() && script()->strict();
-  }
-
-  bool isNonStrictEvalFrame() const {
-    return isEvalFrame() && !script()->strict();
-  }
-
-  bool isNonGlobalEvalFrame() const;
-
-  bool isNonStrictDirectEvalFrame() const {
-    return isNonStrictEvalFrame() && isNonGlobalEvalFrame();
-  }
-
   /*
    * Previous frame
    *
    * A frame's 'prev' frame is either null or the previous frame pointed to
    * by cx->regs->fp when this frame was pushed. Often, given two prev-linked
    * frames, the next-frame is a function or eval that was called by the
    * prev-frame, but not always: the prev-frame may have called a native that
    * reentered the VM through JS_CallFunctionValue on the same context
@@ -519,34 +497,33 @@ class InterpreterFrame {
   /*
    * Environment chain
    *
    * In theory, the environment chain would contain an object for every
    * lexical scope. However, only objects that are required for dynamic
    * lookup are actually created.
    *
    * Given that an InterpreterFrame corresponds roughly to a ES Execution
-   * Context (ES 10.3), InterpreterFrame::varObj corresponds to the
+   * Context (ES 10.3), GetVariablesObject corresponds to the
    * VariableEnvironment component of a Exection Context. Intuitively, the
    * variables object is where new bindings (variables and functions) are
    * stored. One might expect that this is either the Call object or
    * envChain.globalObj for function or global code, respectively, however
    * the JSAPI allows calls of Execute to specify a variables object on the
    * environment chain other than the call/global object. This allows
    * embeddings to run multiple scripts under the same global, each time
    * using a new variables object to collect and discard the script's global
    * variables.
    */
 
   inline HandleObject environmentChain() const;
 
   inline EnvironmentObject& aliasedEnvironment(EnvironmentCoordinate ec) const;
   inline GlobalObject& global() const;
   inline CallObject& callObj() const;
-  inline JSObject& varObj() const;
   inline LexicalEnvironmentObject& extensibleLexicalEnvironment() const;
 
   template <typename SpecificEnvironment>
   inline void pushOnEnvironmentChain(SpecificEnvironment& env);
   template <typename SpecificEnvironment>
   inline void popOffEnvironmentChain();
   inline void replaceInnermostEnvironment(EnvironmentObject& env);
 
@@ -666,21 +643,16 @@ class InterpreterFrame {
 
   void markReturnValue() { flags_ |= HAS_RVAL; }
 
   void setReturnValue(const Value& v) {
     rval_ = v;
     markReturnValue();
   }
 
-  void clearReturnValue() {
-    rval_.setUndefined();
-    markReturnValue();
-  }
-
   void resumeGeneratorFrame(JSObject* envChain) {
     MOZ_ASSERT(script()->isGenerator() || script()->isAsync());
     MOZ_ASSERT(isFunctionFrame());
     flags_ |= HAS_INITIAL_ENV;
     envChain_ = envChain;
   }
 
   /*
@@ -773,24 +745,16 @@ class InterpreterRegs {
     return sp - fp_->base();
   }
 
   Value* spForStackDepth(unsigned depth) const {
     MOZ_ASSERT(fp_->script()->nfixed() + depth <= fp_->script()->nslots());
     return fp_->base() + depth;
   }
 
-  /* For generators. */
-  void rebaseFromTo(const InterpreterRegs& from, InterpreterFrame& to) {
-    fp_ = &to;
-    sp = to.slots() + (from.sp - from.fp_->slots());
-    pc = from.pc;
-    MOZ_ASSERT(fp_);
-  }
-
   void popInlineFrame() {
     pc = fp_->prevpc();
     unsigned spForNewTarget =
         fp_->isResumedGenerator() ? 0 : fp_->isConstructing();
     sp = fp_->prevsp() - fp_->numActualArgs() - 1 - spForNewTarget;
     fp_ = fp_->prev();
     MOZ_ASSERT(fp_);
   }