Bug 1119230 - remove lingering JIT code for PJS. r=shu
authorLars T Hansen <lhansen@mozilla.com>
Wed, 14 Jan 2015 09:21:59 +0100
changeset 250835 2ff00342d08842421b5f84b73c1e9ed315588cf1
parent 250834 84d9dd56529345d791f987a9d292d2525388e712
child 250836 d43317c1d73f526adff9fcf10f29d38d5b089830
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1119230
milestone38.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 1119230 - remove lingering JIT code for PJS. r=shu
js/public/CallArgs.h
js/src/jscntxtinlines.h
js/src/jsfriendapi.h
js/src/jsfun.h
js/src/jsinfer.h
js/src/vm/ForkJoin.cpp
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -37,39 +37,16 @@
 
 #include "js/RootingAPI.h"
 #include "js/Value.h"
 
 /* Typedef for native functions called by the JS VM. */
 typedef bool
 (* JSNative)(JSContext *cx, unsigned argc, JS::Value *vp);
 
-/* Typedef for native functions that may be called in parallel. */
-typedef bool
-(* JSParallelNative)(js::ForkJoinContext *cx, unsigned argc, JS::Value *vp);
-
-/*
- * Typedef for native functions that may be called either in parallel or
- * sequential execution.
- */
-typedef bool
-(* JSThreadSafeNative)(js::ThreadSafeContext *cx, unsigned argc, JS::Value *vp);
-
-/*
- * Convenience wrappers for passing in ThreadSafeNative to places that expect
- * a JSNative or a JSParallelNative.
- */
-template <JSThreadSafeNative threadSafeNative>
-inline bool
-JSNativeThreadSafeWrapper(JSContext *cx, unsigned argc, JS::Value *vp);
-
-template <JSThreadSafeNative threadSafeNative>
-inline bool
-JSParallelNativeThreadSafeWrapper(js::ForkJoinContext *cx, unsigned argc, JS::Value *vp);
-
 /*
  * Compute |this| for the |vp| inside a JSNative, either boxing primitives or
  * replacing with the global object as necessary.
  *
  * This method will go away at some point: instead use |args.thisv()|.  If the
  * value is an object, no further work is required.  If that value is |null| or
  * |undefined|, use |JS_GetGlobalForObject| to compute the global object.  If
  * the value is some other primitive, use |JS_ValueToObject| to box it.
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -480,29 +480,9 @@ JSContext::currentScript(jsbytecode **pp
 
     if (ppc) {
         *ppc = act->asInterpreter()->regs().pc;
         MOZ_ASSERT(script->containsPC(*ppc));
     }
     return script;
 }
 
-template <JSThreadSafeNative threadSafeNative>
-inline bool
-JSNativeThreadSafeWrapper(JSContext *cx, unsigned argc, JS::Value *vp)
-{
-    return threadSafeNative(cx, argc, vp);
-}
-
-template <JSThreadSafeNative threadSafeNative>
-inline bool
-JSParallelNativeThreadSafeWrapper(js::ForkJoinContext *cx, unsigned argc, JS::Value *vp)
-{
-    return threadSafeNative(cx, argc, vp);
-}
-
-/* static */ inline JSContext *
-js::ExecutionModeTraits<js::SequentialExecution>::toContextType(ExclusiveContext *cx)
-{
-    return cx->asJSContext();
-}
-
 #endif /* jscntxtinlines_h */
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -2160,17 +2160,16 @@ typedef bool
 (* JSJitMethodOp)(JSContext *cx, JS::HandleObject thisObj,
                   void *specializedThis, const JSJitMethodCallArgs& args);
 
 struct JSJitInfo {
     enum OpType {
         Getter,
         Setter,
         Method,
-        ParallelNative,
         StaticMethod,
         // Must be last
         OpTypeCount
     };
 
     enum ArgType {
         // Basic types
         String = (1 << 0),
@@ -2215,21 +2214,16 @@ struct JSJitInfo {
         // Alias the world.  Calling this can change arbitrary values anywhere
         // in the system.  Most things fall in this bucket.
         AliasEverything,
 
         // Must be last.
         AliasSetCount
     };
 
-    bool hasParallelNative() const
-    {
-        return type() == ParallelNative;
-    }
-
     bool needsOuterizedThisObject() const
     {
         return type() != Getter && type() != Setter;
     }
 
     bool isTypedMethodJitInfo() const
     {
         return isTypedMethod;
@@ -2249,18 +2243,16 @@ struct JSJitInfo {
     {
         return JSValueType(returnType_);
     }
 
     union {
         JSJitGetterOp getter;
         JSJitSetterOp setter;
         JSJitMethodOp method;
-        /* An alternative native that's safe to call in parallel mode. */
-        JSParallelNative parallelNative;
         /* A DOM static method, used for Promise wrappers */
         JSNative staticMethod;
     };
 
     uint16_t protoID;
     uint16_t depth;
 
     // These fields are carefully packed to take up 4 bytes.  If you need more
@@ -2335,55 +2327,16 @@ struct JSTypedMethodJitInfo
     const JSJitInfo::ArgType* const argTypes; /* For a method, a list of sets of
                                                  types that the function
                                                  expects.  This can be used,
                                                  for example, to figure out
                                                  when argument coercions can
                                                  have side-effects. */
 };
 
-namespace JS {
-namespace detail {
-
-/* NEVER DEFINED, DON'T USE.  For use by JS_CAST_PARALLEL_NATIVE_TO only. */
-inline int CheckIsParallelNative(JSParallelNative parallelNative);
-
-} // namespace detail
-} // namespace JS
-
-#define JS_CAST_PARALLEL_NATIVE_TO(v, To) \
-    (static_cast<void>(sizeof(JS::detail::CheckIsParallelNative(v))), \
-     reinterpret_cast<To>(v))
-
-/*
- * You may ask yourself: why do we define a wrapper around a wrapper here?
- * The answer is that some compilers don't understand initializing a union
- * as we do below with a construct like:
- *
- * reinterpret_cast<JSJitGetterOp>(JSParallelNativeThreadSafeWrapper<op>)
- *
- * (We need the reinterpret_cast because we must initialize the union with
- * a datum of the type of the union's first member.)
- *
- * Presumably this has something to do with template instantiation.
- * Initializing with a normal function pointer seems to work fine. Hence
- * the ugliness that you see before you.
- */
-#define JS_JITINFO_NATIVE_PARALLEL(infoName, parallelOp)                \
-    const JSJitInfo infoName =                                          \
-        {{JS_CAST_PARALLEL_NATIVE_TO(parallelOp, JSJitGetterOp)},0,0,JSJitInfo::ParallelNative,JSJitInfo::AliasEverything,JSVAL_TYPE_MISSING,false,false,false,false,false,0}
-
-#define JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(infoName, wrapperName, serialOp) \
-    bool wrapperName##_ParallelNativeThreadSafeWrapper(js::ForkJoinContext *cx, unsigned argc, \
-                                                       JS::Value *vp)   \
-    {                                                                   \
-        return JSParallelNativeThreadSafeWrapper<serialOp>(cx, argc, vp); \
-    }                                                                   \
-    JS_JITINFO_NATIVE_PARALLEL(infoName, wrapperName##_ParallelNativeThreadSafeWrapper)
-
 static MOZ_ALWAYS_INLINE const JSJitInfo *
 FUNCTION_VALUE_TO_JITINFO(const JS::Value& v)
 {
     MOZ_ASSERT(js::GetObjectClass(&v.toObject()) == js::FunctionClassPtr);
     return reinterpret_cast<js::shadow::Function *>(&v.toObject())->jitinfo;
 }
 
 /* Statically asserted in jsfun.h. */
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -14,18 +14,16 @@
 #include "jsobj.h"
 #include "jsscript.h"
 #include "jstypes.h"
 
 namespace js {
 class FunctionExtended;
 
 typedef JSNative           Native;
-typedef JSParallelNative   ParallelNative;
-typedef JSThreadSafeNative ThreadSafeNative;
 }
 
 struct JSAtomState;
 
 class JSFunction : public js::NativeObject
 {
   public:
     static const js::Class class_;
@@ -152,19 +150,16 @@ class JSFunction : public js::NativeObje
         // Note: the JITs inline this check, so be careful when making changes
         // here. See MacroAssembler::branchIfNotInterpretedConstructor.
         return isInterpreted() && !isFunctionPrototype() && !isArrow() &&
                (!isSelfHostedBuiltin() || isSelfHostedConstructor());
     }
     bool isNamedLambda() const {
         return isLambda() && displayAtom() && !hasGuessedAtom();
     }
-    bool hasParallelNative() const {
-        return isNative() && jitInfo() && jitInfo()->hasParallelNative();
-    }
 
     bool isBuiltinFunctionConstructor();
 
     /* Returns the strictness of this function, which must be interpreted. */
     bool strict() const {
         MOZ_ASSERT(isInterpreted());
         return isInterpretedLazy() ? lazyScript()->strict() : nonLazyScript()->strict();
     }
@@ -397,25 +392,16 @@ class JSFunction : public js::NativeObje
         MOZ_ASSERT(isNative());
         return u.n.native;
     }
 
     JSNative maybeNative() const {
         return isInterpreted() ? nullptr : native();
     }
 
-    JSParallelNative parallelNative() const {
-        MOZ_ASSERT(hasParallelNative());
-        return jitInfo()->parallelNative;
-    }
-
-    JSParallelNative maybeParallelNative() const {
-        return hasParallelNative() ? parallelNative() : nullptr;
-    }
-
     void initNative(js::Native native, const JSJitInfo *jitinfo) {
         MOZ_ASSERT(native);
         u.n.native = native;
         u.n.jitinfo = jitinfo;
     }
 
     const JSJitInfo *jitInfo() const {
         MOZ_ASSERT(isNative());
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -176,37 +176,16 @@ ExecutionModeString(ExecutionMode mode)
 }
 
 /*
  * Not as part of the enum so we don't get warnings about unhandled enum
  * values.
  */
 static const unsigned NumExecutionModes = ParallelExecution + 1;
 
-template <ExecutionMode mode>
-struct ExecutionModeTraits
-{
-};
-
-template <> struct ExecutionModeTraits<SequentialExecution>
-{
-    typedef JSContext * ContextType;
-    typedef ExclusiveContext * ExclusiveContextType;
-
-    static inline JSContext *toContextType(ExclusiveContext *cx);
-};
-
-template <> struct ExecutionModeTraits<ParallelExecution>
-{
-    typedef ForkJoinContext * ContextType;
-    typedef ForkJoinContext * ExclusiveContextType;
-
-    static inline ForkJoinContext *toContextType(ForkJoinContext *cx) { return cx; }
-};
-
 namespace jit {
     struct IonScript;
     class JitAllocPolicy;
     class TempAllocator;
 }
 
 namespace types {
 
--- a/js/src/vm/ForkJoin.cpp
+++ b/js/src/vm/ForkJoin.cpp
@@ -2118,26 +2118,20 @@ intrinsic_SetForkJoinTargetRegionPar(For
     int32_t start = args[1].toInt32();
     int32_t end = args[2].toInt32();
 
     cx->targetRegionStart = mem + start;
     cx->targetRegionEnd = mem + end;
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL(js::intrinsic_SetForkJoinTargetRegionInfo,
-                           intrinsic_SetForkJoinTargetRegionPar);
-
 bool
 js::intrinsic_ClearThreadLocalArenas(JSContext *cx, unsigned argc, Value *vp)
 {
     return true;
 }
 
 static bool
 intrinsic_ClearThreadLocalArenasPar(ForkJoinContext *cx, unsigned argc, Value *vp)
 {
     //cx->allocator()->arenas.wipeDuringParallelExecution(cx->runtime());
     return true;
 }
-
-JS_JITINFO_NATIVE_PARALLEL(js::intrinsic_ClearThreadLocalArenasInfo,
-                           intrinsic_ClearThreadLocalArenasPar);