Bug 1530937 part 1 - Remove FunctionInfo Context template parameter. r=nbp
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 28 Feb 2019 09:37:36 +0000
changeset 519598 d629f7abeca07b44babffed909a38120fe24aceb
parent 519597 00fe264dc8b603832cc16368b24a63f941bdaadf
child 519599 756272e36e32264332e6b95aa804b69581295c7e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1530937
milestone67.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 1530937 part 1 - Remove FunctionInfo Context template parameter. r=nbp This was useful when we had ExclusiveContext and PJS ThreadSafeContext but now we only use JSContext* so it's simpler to just use that. Differential Revision: https://phabricator.services.mozilla.com/D21331
js/src/jit/VMFunctions.h
--- a/js/src/jit/VMFunctions.h
+++ b/js/src/jit/VMFunctions.h
@@ -776,23 +776,16 @@ template <>
 struct OutParamToRootType<MutableHandleObject> {
   static const VMFunction::RootType result = VMFunction::RootObject;
 };
 template <>
 struct OutParamToRootType<MutableHandleString> {
   static const VMFunction::RootType result = VMFunction::RootString;
 };
 
-template <class>
-struct MatchContext {};
-template <>
-struct MatchContext<JSContext*> {
-  static const bool valid = true;
-};
-
 // Extract the last element of a list of types.
 template <typename... ArgTypes>
 struct LastArg;
 
 template <>
 struct LastArg<> {
   typedef void Type;
   static constexpr size_t nbArgs = 0;
@@ -839,19 +832,19 @@ struct BitMask<Each, ResultType, Shift, 
 };
 
 // Extract VMFunction properties based on the signature of the function. The
 // properties are used to generate the logic for calling the VM function, and
 // also for marking the stack during GCs.
 template <typename... Args>
 struct FunctionInfo;
 
-template <class R, class Context, typename... Args>
-struct FunctionInfo<R (*)(Context, Args...)> : public VMFunction {
-  typedef R (*pf)(Context, Args...);
+template <class R, typename... Args>
+struct FunctionInfo<R (*)(JSContext*, Args...)> : public VMFunction {
+  using pf = R (*)(JSContext*, Args...);
 
   static DataType returnType() { return TypeToDataType<R>::result; }
   static DataType outParam() {
     return OutParamToDataType<typename LastArg<Args...>::Type>::result;
   }
   static RootType outParamRootType() {
     return OutParamToRootType<typename LastArg<Args...>::Type>::result;
   }
@@ -869,27 +862,23 @@ struct FunctionInfo<R (*)(Context, Args.
     return BitMask<TypeToRootType, uint64_t, 3, Args...>::result;
   }
   explicit FunctionInfo(pf fun, const char* name,
                         PopValues extraValuesToPop = PopValues(0))
       : VMFunction(JS_FUNC_TO_DATA_PTR(void*, fun), name, explicitArgs(),
                    argumentProperties(), argumentPassedInFloatRegs(),
                    argumentRootTypes(), outParam(), outParamRootType(),
                    returnType(), extraValuesToPop.numValues, NonTailCall) {
-    static_assert(MatchContext<Context>::valid,
-                  "Invalid cx type in VMFunction");
   }
   explicit FunctionInfo(pf fun, const char* name, MaybeTailCall expectTailCall,
                         PopValues extraValuesToPop = PopValues(0))
       : VMFunction(JS_FUNC_TO_DATA_PTR(void*, fun), name, explicitArgs(),
                    argumentProperties(), argumentPassedInFloatRegs(),
                    argumentRootTypes(), outParam(), outParamRootType(),
                    returnType(), extraValuesToPop.numValues, expectTailCall) {
-    static_assert(MatchContext<Context>::valid,
-                  "Invalid cx type in VMFunction");
   }
 };
 
 class AutoDetectInvalidation {
   JSContext* cx_;
   IonScript* ionScript_;
   MutableHandleValue rval_;
   bool disabled_;