Bug 1346389. Make --enable-shared-js link again, at least for an opt mac build with intl api disabled. r=sfink
☠☠ backed out by 11db2a345e5b ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 10 Mar 2017 23:52:55 -0500
changeset 397676 c1978f7d49c440ad6831e84e6808b64400af4a40
parent 397675 bf33ec027cea3933857e578f37e2e577f0cb1e85
child 397677 83b01c14f1f33c2c972ba24b41d0933aac840d23
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1346389
milestone55.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 1346389. Make --enable-shared-js link again, at least for an opt mac build with intl api disabled. r=sfink MozReview-Commit-ID: 264vsCvhh9Z
js/public/CallArgs.h
js/public/Debug.h
js/public/ProfilingFrameIterator.h
js/public/ProfilingStack.h
js/public/RootingAPI.h
js/public/StructuredClone.h
js/public/UbiNode.h
js/public/UbiNodeCensus.h
js/public/Utility.h
js/src/gc/Barrier.cpp
js/src/gc/MemoryProfiler.cpp
js/src/jit/JitcodeMap.cpp
js/src/jit/OptimizationTracking.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsfriendapi.h
js/src/jswrapper.h
js/src/proxy/CrossCompartmentWrapper.cpp
js/src/vm/SavedStacks.cpp
js/src/vm/UbiNodeCensus.cpp
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -297,17 +297,17 @@ class MOZ_STACK_CLASS CallArgs : public 
         return args;
     }
 
   public:
     /*
      * Returns true if there are at least |required| arguments passed in. If
      * false, it reports an error message on the context.
      */
-    bool requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const;
+    JS_PUBLIC_API(bool) requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const;
 
 };
 
 MOZ_ALWAYS_INLINE CallArgs
 CallArgsFromVp(unsigned argc, Value* vp)
 {
     return CallArgs::create(argc, vp + 2, vp[1].isMagic(JS_IS_CONSTRUCTING));
 }
--- a/js/public/Debug.h
+++ b/js/public/Debug.h
@@ -335,17 +335,17 @@ GetDebuggeeGlobals(JSContext* cx, JSObje
 //
 // Construct an instance of this class on the stack, providing a JSContext
 // belonging to the runtime in which execution will occur. Each time we enter
 // JavaScript --- specifically, each time we push a JavaScript stack frame that
 // has no older JS frames younger than this AutoEntryMonitor --- we will
 // call the appropriate |Entry| member function to indicate where we've begun
 // execution.
 
-class MOZ_STACK_CLASS AutoEntryMonitor {
+class MOZ_STACK_CLASS JS_PUBLIC_API(AutoEntryMonitor) {
     JSContext* cx_;
     AutoEntryMonitor* savedMonitor_;
 
   public:
     explicit AutoEntryMonitor(JSContext* cx);
     ~AutoEntryMonitor();
 
     // SpiderMonkey reports the JavaScript entry points occuring within this
--- a/js/public/ProfilingFrameIterator.h
+++ b/js/public/ProfilingFrameIterator.h
@@ -182,20 +182,23 @@ struct ForEachProfiledFrameOp
         void updateHasTrackedOptimizations();
 
       public:
         const char* label() const { return label_; }
         uint32_t depth() const { return depth_; }
         bool hasTrackedOptimizations() const { return optsIndex_.isSome(); }
         void* canonicalAddress() const { return canonicalAddr_; }
 
-        ProfilingFrameIterator::FrameKind frameKind() const;
-        void forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
-                                        JSScript** scriptOut, jsbytecode** pcOut) const;
-        void forEachOptimizationTypeInfo(ForEachTrackedOptimizationTypeInfoOp& op) const;
+        JS_PUBLIC_API(ProfilingFrameIterator::FrameKind) frameKind() const;
+        JS_PUBLIC_API(void) forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
+                                                       JSScript** scriptOut,
+                                                       jsbytecode** pcOut) const;
+
+        JS_PUBLIC_API(void)
+        forEachOptimizationTypeInfo(ForEachTrackedOptimizationTypeInfoOp& op) const;
     };
 
     // Called once per frame.
     virtual void operator()(const FrameHandle& frame) = 0;
 };
 
 JS_PUBLIC_API(void)
 ForEachProfiledFrame(JSContext* cx, void* addr, ForEachProfiledFrameOp& op);
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -18,17 +18,17 @@ class JSTracer;
 
 namespace js {
 
 // A call stack can be specified to the JS engine such that all JS entry/exits
 // to functions push/pop an entry to/from the specified stack.
 //
 // For more detailed information, see vm/GeckoProfiler.h.
 //
-class ProfileEntry
+class JS_PUBLIC_API(ProfileEntry)
 {
     // All fields are marked volatile to prevent the compiler from re-ordering
     // instructions. Namely this sequence:
     //
     //    entry[size] = ...;
     //    size++;
     //
     // If the size modification were somehow reordered before the stores, then
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -669,20 +669,20 @@ struct BarrierMethods<JSFunction*>
 // aggregate Lookup kinds embed a JSObject* that is frequently null and do not
 // null test before dispatching to the hasher.
 template <typename T>
 struct JS_PUBLIC_API(MovableCellHasher)
 {
     using Key = T;
     using Lookup = T;
 
-    static bool hasHash(const Lookup& l);
-    static bool ensureHash(const Lookup& l);
-    static HashNumber hash(const Lookup& l);
-    static bool match(const Key& k, const Lookup& l);
+    static JS_PUBLIC_API(bool) hasHash(const Lookup& l);
+    static JS_PUBLIC_API(bool) ensureHash(const Lookup& l);
+    static JS_PUBLIC_API(HashNumber) hash(const Lookup& l);
+    static JS_PUBLIC_API(bool) match(const Key& k, const Lookup& l);
     static void rekey(Key& k, const Key& newKey) { k = newKey; }
 };
 
 template <typename T>
 struct JS_PUBLIC_API(MovableCellHasher<JS::Heap<T>>)
 {
     using Key = JS::Heap<T>;
     using Lookup = T;
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -183,17 +183,18 @@ struct JSStructuredCloneCallbacks {
 };
 
 enum OwnTransferablePolicy {
     OwnsTransferablesIfAny,
     IgnoreTransferablesIfAny,
     NoTransferables
 };
 
-class MOZ_NON_MEMMOVABLE JSStructuredCloneData : public mozilla::BufferList<js::SystemAllocPolicy>
+class MOZ_NON_MEMMOVABLE JS_PUBLIC_API(JSStructuredCloneData) :
+    public mozilla::BufferList<js::SystemAllocPolicy>
 {
     typedef js::SystemAllocPolicy AllocPolicy;
     typedef mozilla::BufferList<js::SystemAllocPolicy> BufferList;
 
     static const size_t kInitialSize = 0;
     static const size_t kInitialCapacity = 4096;
     static const size_t kStandardCapacity = 4096;
 
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -188,17 +188,17 @@ using Vector = mozilla::Vector<T, 0, js:
 
 /*** ubi::StackFrame ******************************************************************************/
 
 // Concrete JS::ubi::StackFrame instances backed by a live SavedFrame object
 // store their strings as JSAtom*, while deserialized stack frames from offline
 // heap snapshots store their strings as const char16_t*. In order to provide
 // zero-cost accessors to these strings in a single interface that works with
 // both cases, we use this variant type.
-class AtomOrTwoByteChars : public Variant<JSAtom*, const char16_t*> {
+class JS_PUBLIC_API(AtomOrTwoByteChars) : public Variant<JSAtom*, const char16_t*> {
     using Base = Variant<JSAtom*, const char16_t*>;
 
   public:
     template<typename T>
     MOZ_IMPLICIT AtomOrTwoByteChars(T&& rhs) : Base(Forward<T>(rhs)) { }
 
     template<typename T>
     AtomOrTwoByteChars& operator=(T&& rhs) {
@@ -461,18 +461,20 @@ class ConcreteStackFrame<void> : public 
     uint32_t column() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     AtomOrTwoByteChars source() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     AtomOrTwoByteChars functionDisplayName() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     StackFrame parent() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     bool isSystem() const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
     bool isSelfHosted(JSContext* cx) const override { MOZ_CRASH("null JS::ubi::StackFrame"); }
 };
 
-MOZ_MUST_USE bool ConstructSavedFrameStackSlow(JSContext* cx, JS::ubi::StackFrame& frame,
-                                               MutableHandleObject outSavedFrameStack);
+MOZ_MUST_USE JS_PUBLIC_API(bool)
+ConstructSavedFrameStackSlow(JSContext* cx,
+                             JS::ubi::StackFrame& frame,
+                             MutableHandleObject outSavedFrameStack);
 
 
 /*** ubi::Node ************************************************************************************/
 
 // A concrete node specialization can claim its referent is a member of a
 // particular "coarse type" which is less specific than the actual
 // implementation type but generally more palatable for web developers. For
 // example, JitCode can be considered to have a coarse type of "Script". This is
@@ -964,17 +966,17 @@ class PreComputedEdgeRange : public Edge
 //
 //        // The AutoCheckCannotGC is guaranteed to exist if init returned true.
 //        MOZ_ASSERT(maybeNoGC.isSome());
 //
 //        JS::ubi::Node root(&rootList);
 //
 //        ...
 //    }
-class MOZ_STACK_CLASS RootList {
+class MOZ_STACK_CLASS JS_PUBLIC_API(RootList) {
     Maybe<AutoCheckCannotGC>& noGC;
 
   public:
     JSContext* cx;
     EdgeVector edges;
     bool       wantNames;
 
     RootList(JSContext* cx, Maybe<AutoCheckCannotGC>& noGC, bool wantNames = false);
@@ -996,17 +998,17 @@ class MOZ_STACK_CLASS RootList {
     // edgeName.
     MOZ_MUST_USE bool addRoot(Node node, const char16_t* edgeName = nullptr);
 };
 
 
 /*** Concrete classes for ubi::Node referent types ************************************************/
 
 template<>
-class Concrete<RootList> : public Base {
+class JS_PUBLIC_API(Concrete<RootList>) : public Base {
   protected:
     explicit Concrete(RootList* ptr) : Base(ptr) { }
     RootList& get() const { return *static_cast<RootList*>(ptr); }
 
   public:
     static void construct(void* storage, RootList* ptr) { new (storage) Concrete(ptr); }
 
     js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
@@ -1035,50 +1037,50 @@ class TracerConcreteWithCompartment : pu
 
   protected:
     explicit TracerConcreteWithCompartment(Referent* ptr) : TracerBase(ptr) { }
 };
 
 // Define specializations for some commonly-used public JSAPI types.
 // These can use the generic templates above.
 template<>
-class Concrete<JS::Symbol> : TracerConcrete<JS::Symbol> {
+class JS_PUBLIC_API(Concrete<JS::Symbol>) : TracerConcrete<JS::Symbol> {
   protected:
     explicit Concrete(JS::Symbol* ptr) : TracerConcrete(ptr) { }
 
   public:
     static void construct(void* storage, JS::Symbol* ptr) {
         new (storage) Concrete(ptr);
     }
 
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 template<>
-class Concrete<JSScript> : TracerConcreteWithCompartment<JSScript> {
+class JS_PUBLIC_API(Concrete<JSScript>) : TracerConcreteWithCompartment<JSScript> {
   protected:
     explicit Concrete(JSScript *ptr) : TracerConcreteWithCompartment<JSScript>(ptr) { }
 
   public:
     static void construct(void *storage, JSScript *ptr) { new (storage) Concrete(ptr); }
 
     CoarseType coarseType() const final { return CoarseType::Script; }
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
     const char* scriptFilename() const final;
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // The JSObject specialization.
 template<>
-class Concrete<JSObject> : public TracerConcreteWithCompartment<JSObject> {
+class JS_PUBLIC_API(Concrete<JSObject>) : public TracerConcreteWithCompartment<JSObject> {
   protected:
     explicit Concrete(JSObject* ptr) : TracerConcreteWithCompartment(ptr) { }
 
   public:
     static void construct(void* storage, JSObject* ptr) {
         new (storage) Concrete(ptr);
     }
 
@@ -1093,34 +1095,34 @@ class Concrete<JSObject> : public Tracer
     CoarseType coarseType() const final { return CoarseType::Object; }
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // For JSString, we extend the generic template with a 'size' implementation.
 template<>
-class Concrete<JSString> : TracerConcrete<JSString> {
+class JS_PUBLIC_API(Concrete<JSString>) : TracerConcrete<JSString> {
   protected:
     explicit Concrete(JSString *ptr) : TracerConcrete<JSString>(ptr) { }
 
   public:
     static void construct(void *storage, JSString *ptr) { new (storage) Concrete(ptr); }
 
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
 
     CoarseType coarseType() const final { return CoarseType::String; }
 
     const char16_t* typeName() const override { return concreteTypeName; }
     static const char16_t concreteTypeName[];
 };
 
 // The ubi::Node null pointer. Any attempt to operate on a null ubi::Node asserts.
 template<>
-class Concrete<void> : public Base {
+class JS_PUBLIC_API(Concrete<void>) : public Base {
     const char16_t* typeName() const override;
     Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
     js::UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
     JS::Zone* zone() const override;
     JSCompartment* compartment() const override;
     CoarseType coarseType() const final;
 
     explicit Concrete(void* ptr) : Base(ptr) { }
--- a/js/public/UbiNodeCensus.h
+++ b/js/public/UbiNodeCensus.h
@@ -78,17 +78,17 @@
 namespace JS {
 namespace ubi {
 
 struct Census;
 
 class CountBase;
 
 struct CountDeleter {
-    void operator()(CountBase*);
+    JS_PUBLIC_API(void) operator()(CountBase*);
 };
 
 using CountBasePtr = js::UniquePtr<CountBase, CountDeleter>;
 
 // Abstract base class for CountType nodes.
 struct CountType {
     explicit CountType() { }
     virtual ~CountType() { }
@@ -198,17 +198,17 @@ struct Census {
     // If the targetZones set is non-empty, then only consider nodes whose zone
     // is an element of the set. If the targetZones set is empty, then nodes in
     // all zones are considered.
     JS::ZoneSet targetZones;
     Zone* atomsZone;
 
     explicit Census(JSContext* cx) : cx(cx), atomsZone(nullptr) { }
 
-    MOZ_MUST_USE bool init();
+    MOZ_MUST_USE JS_PUBLIC_API(bool) init();
 };
 
 // A BreadthFirst handler type that conducts a census, using a CountBase to
 // categorize and count each node.
 class CensusHandler {
     Census& census;
     CountBasePtr& rootCount;
     mozilla::MallocSizeOf mallocSizeOf;
@@ -222,30 +222,31 @@ class CensusHandler {
 
     MOZ_MUST_USE bool report(JSContext* cx, MutableHandleValue report) {
         return rootCount->report(cx, report);
     }
 
     // This class needs to retain no per-node data.
     class NodeData { };
 
-    MOZ_MUST_USE bool operator() (BreadthFirst<CensusHandler>& traversal,
-                                  Node origin, const Edge& edge,
-                                  NodeData* referentData, bool first);
+    MOZ_MUST_USE JS_PUBLIC_API(bool) operator() (BreadthFirst<CensusHandler>& traversal,
+                                                 Node origin, const Edge& edge,
+                                                 NodeData* referentData, bool first);
 };
 
 using CensusTraversal = BreadthFirst<CensusHandler>;
 
 // Examine the census options supplied by the API consumer, and (among other
 // things) use that to build a CountType tree.
-MOZ_MUST_USE bool ParseCensusOptions(JSContext* cx, Census& census, HandleObject options,
-                                     CountTypePtr& outResult);
+MOZ_MUST_USE JS_PUBLIC_API(bool) ParseCensusOptions(JSContext* cx,
+                                                    Census& census, HandleObject options,
+                                                    CountTypePtr& outResult);
 
 // Parse the breakdown language (as described in
 // js/src/doc/Debugger/Debugger.Memory.md) into a CountTypePtr. A null pointer
 // is returned on error and is reported to the cx.
-CountTypePtr ParseBreakdown(JSContext* cx, HandleValue breakdownValue);
+JS_PUBLIC_API(CountTypePtr) ParseBreakdown(JSContext* cx, HandleValue breakdownValue);
 
 
 } // namespace ubi
 } // namespace JS
 
 #endif // js_UbiNodeCensus_h
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -173,17 +173,17 @@ static inline bool ShouldFailWithOOM() {
 } /* namespace oom */
 } /* namespace js */
 
 # endif /* DEBUG || JS_OOM_BREAKPOINT */
 
 namespace js {
 
 /* Disable OOM testing in sections which are not OOM safe. */
-struct MOZ_RAII AutoEnterOOMUnsafeRegion
+struct MOZ_RAII JS_PUBLIC_DATA(AutoEnterOOMUnsafeRegion)
 {
     MOZ_NORETURN MOZ_COLD void crash(const char* reason);
     MOZ_NORETURN MOZ_COLD void crash(size_t size, const char* reason);
 
     using AnnotateOOMAllocationSizeCallback = void(*)(size_t);
     static AnnotateOOMAllocationSizeCallback annotateOOMSizeCallback;
     static void setAnnotateOOMAllocationSizeCallback(AnnotateOOMAllocationSizeCallback callback) {
         annotateOOMSizeCallback = callback;
--- a/js/src/gc/Barrier.cpp
+++ b/js/src/gc/Barrier.cpp
@@ -113,55 +113,55 @@ PreBarrierFunctor<S>::operator()(T* t)
 template void PreBarrierFunctor<JS::Value>::operator()<type>(type*);
 JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
 #undef JS_EXPAND_DEF
 
 template void PreBarrierFunctor<jsid>::operator()<JS::Symbol>(JS::Symbol*);
 template void PreBarrierFunctor<jsid>::operator()<JSString>(JSString*);
 
 template <typename T>
-/* static */ bool
+/* static */ JS_PUBLIC_API(bool)
 MovableCellHasher<T>::hasHash(const Lookup& l)
 {
     if (!l)
         return true;
 
     return l->zoneFromAnyThread()->hasUniqueId(l);
 }
 
 template <typename T>
-/* static */ bool
+/* static */ JS_PUBLIC_API(bool)
 MovableCellHasher<T>::ensureHash(const Lookup& l)
 {
     if (!l)
         return true;
 
     uint64_t unusedId;
     return l->zoneFromAnyThread()->getUniqueId(l, &unusedId);
 }
 
 template <typename T>
-/* static */ HashNumber
+/* static */ JS_PUBLIC_API(HashNumber)
 MovableCellHasher<T>::hash(const Lookup& l)
 {
     if (!l)
         return 0;
 
     // We have to access the zone from-any-thread here: a worker thread may be
     // cloning a self-hosted object from the main runtime's self- hosting zone
     // into another runtime. The zone's uid lock will protect against multiple
     // workers doing this simultaneously.
     MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) ||
                l->zoneFromAnyThread()->isSelfHostingZone());
 
     return l->zoneFromAnyThread()->getHashCodeInfallible(l);
 }
 
 template <typename T>
-/* static */ bool
+/* static */ JS_PUBLIC_API(bool)
 MovableCellHasher<T>::match(const Key& k, const Lookup& l)
 {
     // Return true if both are null or false if only one is null.
     if (!k)
         return !l;
     if (!l)
         return false;
 
@@ -175,17 +175,17 @@ MovableCellHasher<T>::match(const Key& k
         return false;
     MOZ_ASSERT(zone->hasUniqueId(k));
     MOZ_ASSERT(zone->hasUniqueId(l));
 
     // Since both already have a uid (from hash), the get is infallible.
     return zone->getUniqueIdInfallible(k) == zone->getUniqueIdInfallible(l);
 }
 
-template struct MovableCellHasher<JSObject*>;
+template struct JS_PUBLIC_API(MovableCellHasher<JSObject*>);
 template struct MovableCellHasher<GlobalObject*>;
 template struct MovableCellHasher<SavedFrame*>;
 template struct MovableCellHasher<EnvironmentObject*>;
 template struct MovableCellHasher<WasmInstanceObject*>;
 template struct MovableCellHasher<JSScript*>;
 
 } // namespace js
 
--- a/js/src/gc/MemoryProfiler.cpp
+++ b/js/src/gc/MemoryProfiler.cpp
@@ -22,28 +22,28 @@ MemProfiler::GetGCHeapProfiler(void* add
 }
 
 GCHeapProfiler*
 MemProfiler::GetGCHeapProfiler(JSRuntime* runtime)
 {
     return runtime->gc.mMemProfiler.mGCHeapProfiler;
 }
 
-MemProfiler*
+JS_FRIEND_API(MemProfiler*)
 MemProfiler::GetMemProfiler(JSContext* context)
 {
     return &context->runtime()->gc.mMemProfiler;
 }
 
-void
+JS_FRIEND_API(void)
 MemProfiler::start(GCHeapProfiler* aGCHeapProfiler)
 {
     ReleaseAllJITCode(mRuntime->defaultFreeOp());
     mGCHeapProfiler = aGCHeapProfiler;
     sActiveProfilerCount++;
 }
 
-void
+JS_FRIEND_API(void)
 MemProfiler::stop()
 {
     sActiveProfilerCount--;
     mGCHeapProfiler = nullptr;
 }
--- a/js/src/jit/JitcodeMap.cpp
+++ b/js/src/jit/JitcodeMap.cpp
@@ -1632,17 +1632,17 @@ JS::ForEachProfiledFrameOp::FrameHandle:
     if (!canonicalAddr_) {
         // If the entry has tracked optimizations, updateHasTrackedOptimizations
         // would have updated the canonical address.
         MOZ_ASSERT_IF(entry_.isIon(), !hasTrackedOptimizations());
         canonicalAddr_ = entry_.canonicalNativeAddrFor(rt_, addr_);
     }
 }
 
-JS::ProfilingFrameIterator::FrameKind
+JS_PUBLIC_API(JS::ProfilingFrameIterator::FrameKind)
 JS::ForEachProfiledFrameOp::FrameHandle::frameKind() const
 {
     if (entry_.isBaseline())
         return JS::ProfilingFrameIterator::Frame_Baseline;
     return JS::ProfilingFrameIterator::Frame_Ion;
 }
 
 JS_PUBLIC_API(void)
--- a/js/src/jit/OptimizationTracking.cpp
+++ b/js/src/jit/OptimizationTracking.cpp
@@ -1289,24 +1289,24 @@ FrameHandle::updateHasTrackedOptimizatio
         return;
 
     uint32_t entryOffset;
     optsIndex_ = entry_.trackedOptimizationIndexAtAddr(rt_, addr_, &entryOffset);
     if (optsIndex_.isSome())
         canonicalAddr_ = (void*)(((uint8_t*) entry_.nativeStartAddr()) + entryOffset);
 }
 
-void
+JS_PUBLIC_API(void)
 FrameHandle::forEachOptimizationAttempt(ForEachTrackedOptimizationAttemptOp& op,
                                         JSScript** scriptOut, jsbytecode** pcOut) const
 {
     MOZ_ASSERT(optsIndex_.isSome());
     entry_.forEachOptimizationAttempt(rt_, *optsIndex_, op);
     entry_.youngestFrameLocationAtAddr(rt_, addr_, scriptOut, pcOut);
 }
 
-void
+JS_PUBLIC_API(void)
 FrameHandle::forEachOptimizationTypeInfo(ForEachTrackedOptimizationTypeInfoOp& op) const
 {
     MOZ_ASSERT(optsIndex_.isSome());
     IonTrackedOptimizationsTypeInfo::ForEachOpAdapter adapter(op);
     entry_.forEachOptimizationTypeInfo(rt_, *optsIndex_, adapter);
 }
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -114,17 +114,17 @@ using JS::ToInteger;
 using JS::ToUint32;
 
 #ifdef HAVE_VA_LIST_AS_ARRAY
 #define JS_ADDRESSOF_VA_LIST(ap) ((va_list*)(ap))
 #else
 #define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
 #endif
 
-bool
+JS_PUBLIC_API(bool)
 JS::CallArgs::requireAtLeast(JSContext* cx, const char* fnname, unsigned required) const
 {
     if (length() < required) {
         char numArgsStr[40];
         SprintfLiteral(numArgsStr, "%u", required - 1);
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                                   fnname, numArgsStr, required == 2 ? "" : "s");
         return false;
@@ -3142,17 +3142,17 @@ JS_DefineConstDoubles(JSContext* cx, Han
     return DefineConstScalar(cx, obj, cds);
 }
 JS_PUBLIC_API(bool)
 JS_DefineConstIntegers(JSContext* cx, HandleObject obj, const JSConstIntegerSpec* cis)
 {
     return DefineConstScalar(cx, obj, cis);
 }
 
-bool
+JS_PUBLIC_API(bool)
 JSPropertySpec::getValue(JSContext* cx, MutableHandleValue vp) const
 {
     MOZ_ASSERT(!isAccessor());
 
     if (value.type == JSVAL_TYPE_STRING) {
         RootedAtom atom(cx, Atomize(cx, value.string, strlen(value.string)));
         if (!atom)
             return false;
@@ -6409,17 +6409,17 @@ JSErrorNotes::addNoteUTF8(JSContext* cx,
 
     if (!note)
         return false;
     if (!notes_.append(Move(note)))
         return false;
     return true;
 }
 
-size_t
+JS_PUBLIC_API(size_t)
 JSErrorNotes::length()
 {
     return notes_.length();
 }
 
 UniquePtr<JSErrorNotes>
 JSErrorNotes::copy(JSContext* cx)
 {
@@ -6434,23 +6434,23 @@ JSErrorNotes::copy(JSContext* cx)
 
         if (!copiedNotes->notes_.append(Move(copied)))
             return nullptr;
     }
 
     return copiedNotes;
 }
 
-JSErrorNotes::iterator
+JS_PUBLIC_API(JSErrorNotes::iterator)
 JSErrorNotes::begin()
 {
     return iterator(notes_.begin());
 }
 
-JSErrorNotes::iterator
+JS_PUBLIC_API(JSErrorNotes::iterator)
 JSErrorNotes::end()
 {
     return iterator(notes_.end());
 }
 
 JS_PUBLIC_API(bool)
 JS_ThrowStopIteration(JSContext* cx)
 {
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1995,17 +1995,17 @@ struct JSPropertySpec {
             } setter;
         } accessors;
         ValueWrapper            value;
     };
 
     bool isAccessor() const {
         return !(flags & JSPROP_INTERNAL_USE_BIT);
     }
-    bool getValue(JSContext* cx, JS::MutableHandleValue value) const;
+    JS_PUBLIC_API(bool) getValue(JSContext* cx, JS::MutableHandleValue value) const;
 
     bool isSelfHosted() const {
         MOZ_ASSERT(isAccessor());
 
 #ifdef DEBUG
         // Verify that our accessors match our JSPROP_GETTER flag.
         if (flags & JSPROP_GETTER)
             checkAccessorsAreSelfHosted();
@@ -5525,17 +5525,17 @@ class JSErrorNotes
                        const char* filename, unsigned lineno, unsigned column,
                        JSErrorCallback errorCallback, void* userRef,
                        const unsigned errorNumber, ...);
     bool addNoteUTF8(JSContext* cx,
                      const char* filename, unsigned lineno, unsigned column,
                      JSErrorCallback errorCallback, void* userRef,
                      const unsigned errorNumber, ...);
 
-    size_t length();
+    JS_PUBLIC_API(size_t) length();
 
     // Create a deep copy of notes.
     js::UniquePtr<JSErrorNotes> copy(JSContext* cx);
 
     class iterator : public std::iterator<std::input_iterator_tag, js::UniquePtr<Note>>
     {
         js::UniquePtr<Note>* note_;
       public:
@@ -5551,18 +5551,18 @@ class JSErrorNotes
         iterator& operator++() {
             note_++;
             return *this;
         }
         reference operator*() {
             return *note_;
         }
     };
-    iterator begin();
-    iterator end();
+    JS_PUBLIC_API(iterator) begin();
+    JS_PUBLIC_API(iterator) end();
 };
 
 /**
  * Describes a single error or warning that occurs in the execution of script.
  */
 class JSErrorReport : public JSErrorBase
 {
     // Offending source line without final '\n'.
@@ -6456,17 +6456,17 @@ struct MaxFrames
     }
 };
 
 /**
  * Capture the first frame with the given principals. By default, do not
  * consider self-hosted frames with the given principals as satisfying the stack
  * capture.
  */
-struct FirstSubsumedFrame
+struct JS_PUBLIC_API(FirstSubsumedFrame)
 {
     JSContext* cx;
     JSPrincipals* principals;
     bool ignoreSelfHosted;
 
     /**
      * Use the cx's current compartment's principals.
      */
@@ -6677,17 +6677,17 @@ namespace js {
 class AutoStopwatch;
 
 /**
  * Abstract base class for a representation of the performance of a
  * component. Embeddings interested in performance monitoring should
  * provide a concrete implementation of this class, as well as the
  * relevant callbacks (see below).
  */
-struct PerformanceGroup {
+struct JS_PUBLIC_API(PerformanceGroup) {
     PerformanceGroup();
 
     // The current iteration of the event loop.
     uint64_t iteration() const;
 
     // `true` if an instance of `AutoStopwatch` is already monitoring
     // the performance of this performance group for this iteration
     // of the event loop, `false` otherwise.
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -1330,17 +1330,17 @@ GetErrorMessage(void* userRef, const uns
  * This class provides safe access to a string's chars across a GC. Once
  * we allocate strings and chars in the nursery (bug 903519), this class
  * will have to make a copy of the string's chars if they are allocated
  * in the nursery, so it's best to avoid using this class unless you really
  * need it. It's usually more efficient to use the latin1Chars/twoByteChars
  * JSString methods and often the code can be rewritten so that only indexes
  * instead of char pointers are used in parts of the code that can GC.
  */
-class MOZ_STACK_CLASS AutoStableStringChars
+class MOZ_STACK_CLASS JS_FRIEND_API(AutoStableStringChars)
 {
     /*
      * When copying string char, use this many bytes of inline storage.  This is
      * chosen to allow the inline string types to be copied without allocating.
      * This is asserted in AutoStableStringChars::allocOwnChars.
      */
     static const size_t InlineCapacity = 24;
 
@@ -2982,17 +2982,17 @@ class GCHeapProfiler
     virtual void markTenuredStart() = 0;
     virtual void markTenured(void* addr) = 0;
     virtual void sweepTenured() = 0;
     virtual void sweepNursery() = 0;
     virtual void moveNurseryToTenured(void* addrOld, void* addrNew) = 0;
     virtual void reset() = 0;
 };
 
-class MemProfiler
+class JS_FRIEND_API(MemProfiler)
 {
     static mozilla::Atomic<uint32_t, mozilla::Relaxed> sActiveProfilerCount;
     static NativeProfiler* sNativeProfiler;
 
     static GCHeapProfiler* GetGCHeapProfiler(void* addr);
     static GCHeapProfiler* GetGCHeapProfiler(JSRuntime* runtime);
 
     static NativeProfiler* GetNativeProfiler() {
@@ -3000,28 +3000,28 @@ class MemProfiler
     }
 
     GCHeapProfiler* mGCHeapProfiler;
     JSRuntime* mRuntime;
 
   public:
     explicit MemProfiler(JSRuntime* aRuntime) : mGCHeapProfiler(nullptr), mRuntime(aRuntime) {}
 
-    void start(GCHeapProfiler* aGCHeapProfiler);
-    void stop();
+    JS_FRIEND_API(void) start(GCHeapProfiler* aGCHeapProfiler);
+    JS_FRIEND_API(void) stop();
 
     GCHeapProfiler* getGCHeapProfiler() const {
         return mGCHeapProfiler;
     }
 
     static MOZ_ALWAYS_INLINE bool enabled() {
         return sActiveProfilerCount > 0;
     }
 
-    static MemProfiler* GetMemProfiler(JSContext* context);
+    static JS_FRIEND_API(MemProfiler*) GetMemProfiler(JSContext* context);
 
     static void SetNativeProfiler(NativeProfiler* aProfiler) {
         sNativeProfiler = aProfiler;
     }
 
     static MOZ_ALWAYS_INLINE void SampleNative(void* addr, uint32_t size) {
         JS::AutoSuppressGCAnalysis nogc;
 
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -359,17 +359,17 @@ JS_FRIEND_API(JSObject*)
 UnwrapOneChecked(JSObject* obj, bool stopAtWindowProxy = true);
 
 void
 ReportAccessDenied(JSContext* cx);
 
 JS_FRIEND_API(bool)
 IsCrossCompartmentWrapper(JSObject* obj);
 
-void
+JS_FRIEND_API(void)
 NukeCrossCompartmentWrapper(JSContext* cx, JSObject* wrapper);
 
 void
 RemapWrapper(JSContext* cx, JSObject* wobj, JSObject* newTarget);
 
 JS_FRIEND_API(bool)
 RemapAllWrappersForObject(JSContext* cx, JSObject* oldTarget,
                           JSObject* newTarget);
--- a/js/src/proxy/CrossCompartmentWrapper.cpp
+++ b/js/src/proxy/CrossCompartmentWrapper.cpp
@@ -486,17 +486,17 @@ const CrossCompartmentWrapper CrossCompa
 
 bool
 js::IsCrossCompartmentWrapper(JSObject* obj)
 {
     return IsWrapper(obj) &&
            !!(Wrapper::wrapperHandler(obj)->flags() & Wrapper::CROSS_COMPARTMENT);
 }
 
-void
+JS_FRIEND_API(void)
 js::NukeCrossCompartmentWrapper(JSContext* cx, JSObject* wrapper)
 {
     MOZ_ASSERT(wrapper->is<CrossCompartmentWrapperObject>());
 
     NotifyGCNukeWrapper(wrapper);
 
     wrapper->as<ProxyObject>().nuke();
 
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -1720,18 +1720,19 @@ struct MOZ_STACK_CLASS AtomizingMatcher
     }
 
     JSAtom* match(const char16_t* chars) {
         MOZ_ASSERT(chars);
         return AtomizeChars(cx, chars, length);
     }
 };
 
-bool ConstructSavedFrameStackSlow(JSContext* cx, JS::ubi::StackFrame& frame,
-                                  MutableHandleObject outSavedFrameStack)
+JS_PUBLIC_API(bool)
+ConstructSavedFrameStackSlow(JSContext* cx, JS::ubi::StackFrame& frame,
+                             MutableHandleObject outSavedFrameStack)
 {
     SavedFrame::AutoLookupVector stackChain(cx);
     Rooted<JS::ubi::StackFrame> ubiFrame(cx, frame);
 
     while (ubiFrame.get()) {
         // Convert the source and functionDisplayName strings to atoms.
 
         js::RootedAtom source(cx);
--- a/js/src/vm/UbiNodeCensus.cpp
+++ b/js/src/vm/UbiNodeCensus.cpp
@@ -12,29 +12,29 @@
 
 #include "vm/NativeObject-inl.h"
 
 using namespace js;
 
 namespace JS {
 namespace ubi {
 
-void
+JS_PUBLIC_API(void)
 CountDeleter::operator()(CountBase* ptr)
 {
     if (!ptr)
         return;
 
     // Downcast to our true type and destruct, as guided by our CountType
     // pointer.
     ptr->destruct();
     js_free(ptr);
 }
 
-bool
+JS_PUBLIC_API(bool)
 Census::init() {
     AutoLockForExclusiveAccess lock(cx);
     atomsZone = cx->runtime()->atomsCompartment(lock)->zone();
     return targetZones.init();
 }
 
 
 /*** Count Types ***********************************************************************************/
@@ -910,17 +910,17 @@ ByFilename::report(JSContext* cx, CountB
 
     report.setObject(*obj);
     return true;
 }
 
 
 /*** Census Handler *******************************************************************************/
 
-bool
+JS_PUBLIC_API(bool)
 CensusHandler::operator() (BreadthFirst<CensusHandler>& traversal,
                            Node origin, const Edge& edge,
                            NodeData* referentData, bool first)
 {
     // We're only interested in the first time we reach edge.referent, not
     // in every edge arriving at that node.
     if (!first)
         return true;
@@ -953,17 +953,17 @@ static CountTypePtr
 ParseChildBreakdown(JSContext* cx, HandleObject breakdown, PropertyName* prop)
 {
     RootedValue v(cx);
     if (!GetProperty(cx, breakdown, breakdown, prop, &v))
         return nullptr;
     return ParseBreakdown(cx, v);
 }
 
-CountTypePtr
+JS_PUBLIC_API(CountTypePtr)
 ParseBreakdown(JSContext* cx, HandleValue breakdownValue)
 {
     if (breakdownValue.isUndefined()) {
         // Construct the default type, { by: 'count' }
         CountTypePtr simple(cx->new_<SimpleCount>());
         return simple;
     }
 
@@ -1145,17 +1145,17 @@ GetDefaultBreakdown(JSContext* cx)
         return nullptr;
 
     return CountTypePtr(cx->new_<ByCoarseType>(objects,
                                                scripts,
                                                strings,
                                                other));
 }
 
-bool
+JS_PUBLIC_API(bool)
 ParseCensusOptions(JSContext* cx, Census& census, HandleObject options, CountTypePtr& outResult)
 {
     RootedValue breakdown(cx, UndefinedValue());
     if (options && !GetProperty(cx, options, options, cx->names().breakdown, &breakdown))
         return false;
 
     outResult = breakdown.isUndefined()
         ? GetDefaultBreakdown(cx)