Bug 924642 - SpiderMonkey: Apply internal name linkage using static keywords. r=njn
authorDan Gohman <sunfish@google.com>
Thu, 10 Oct 2013 05:18:01 -0700
changeset 164172 37ca290c9256bf3c342a0d8752eac19a6f540e96
parent 164171 655490859d7780e5821cbce06618d768bbd24b30
child 164173 00e39c694626e8354e7265be22e685664ff209f3
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs924642
milestone27.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 924642 - SpiderMonkey: Apply internal name linkage using static keywords. r=njn
js/src/builtin/Object.cpp
js/src/builtin/TypedObject.cpp
js/src/ctypes/CTypes.cpp
js/src/devtools/vprof/vprof.cpp
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/FoldConstants.cpp
js/src/frontend/TokenStream.cpp
js/src/gc/Verifier.cpp
js/src/gdb/gdb-tests.cpp
js/src/jit/IonAnalysis.cpp
js/src/jit/IonBuilder.cpp
js/src/jit/IonCaches.cpp
js/src/jit/IonMacroAssembler.cpp
js/src/jit/ParallelFunctions.cpp
js/src/jit/RangeAnalysis.cpp
js/src/jit/arm/Assembler-arm.cpp
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsbool.cpp
js/src/jsdate.cpp
js/src/jsdtoa.cpp
js/src/jsinfer.cpp
js/src/jsiter.cpp
js/src/jsmath.cpp
js/src/jsnum.cpp
js/src/jsobj.cpp
js/src/jsstr.cpp
js/src/jsutil.h
js/src/perf/jsperf.cpp
js/src/vm/Debugger.cpp
js/src/vm/Interpreter.cpp
js/src/vm/SelfHosting.cpp
js/src/vm/Shape.cpp
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/nsXPConnect.cpp
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -479,17 +479,17 @@ obj_lookupSetter(JSContext *cx, unsigned
                 args.rval().set(shape->setterValue());
         }
     }
     return true;
 }
 #endif /* JS_OLD_GETTER_SETTER_METHODS */
 
 /* ES5 15.2.3.2. */
-bool
+static bool
 obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     /* Step 1. */
     if (args.length() == 0) {
         js_ReportMissingArg(cx, args.calleev(), 0);
         return false;
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -315,17 +315,17 @@ TypeEquivalent(JSContext *cx, unsigned i
     nullptr                                                                   \
 },
 
 const Class js::NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX] = {
     JS_FOR_EACH_SCALAR_TYPE_REPR(BINARYDATA_NUMERIC_CLASSES)
 };
 
 template <typename Domain, typename Input>
-bool
+static bool
 InRange(Input x)
 {
     return std::numeric_limits<Domain>::min() <= x &&
            x <= std::numeric_limits<Domain>::max();
 }
 
 template <>
 bool
@@ -512,17 +512,17 @@ NumericTypeToString(JSContext *cx, unsig
  *   var S = new StructType({...})
  *
  * A.prototype.__proto__ === ArrayType.prototype.prototype (and similar for
  * StructType).
  *
  * This function takes a reference to either ArrayType or StructType and
  * returns a JSObject which can be set as A.prototype.
  */
-JSObject *
+static JSObject *
 SetupAndGetPrototypeObjectForComplexTypeInstance(JSContext *cx,
                                                  HandleObject complexTypeGlobal)
 {
     RootedObject global(cx, cx->compartment()->maybeGlobal());
     RootedValue complexTypePrototypeVal(cx);
     RootedValue complexTypePrototypePrototypeVal(cx);
 
     if (!JSObject::getProperty(cx, complexTypeGlobal, complexTypeGlobal,
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -789,28 +789,28 @@ static const JSFunctionSpec sModuleFunct
   JS_FN("CDataFinalizer", CDataFinalizer::Construct, 2, CTYPESFN_FLAGS),
   JS_FN("open", Library::Open, 1, CTYPESFN_FLAGS),
   JS_FN("cast", CData::Cast, 2, CTYPESFN_FLAGS),
   JS_FN("getRuntime", CData::GetRuntime, 1, CTYPESFN_FLAGS),
   JS_FN("libraryName", Library::Name, 1, CTYPESFN_FLAGS),
   JS_FS_END
 };
 
-JS_ALWAYS_INLINE JSString*
+static JS_ALWAYS_INLINE JSString*
 NewUCString(JSContext* cx, const AutoString& from)
 {
   return JS_NewUCStringCopyN(cx, from.begin(), from.length());
 }
 
 /*
  * Return a size rounded up to a multiple of a power of two.
  *
  * Note: |align| must be a power of 2.
  */
-JS_ALWAYS_INLINE size_t
+static JS_ALWAYS_INLINE size_t
 Align(size_t val, size_t align)
 {
   // Ensure that align is a power of two.
   MOZ_ASSERT(align != 0 && (align & (align - 1)) == 0);
   return ((val - 1) | (align - 1)) + 1;
 }
 
 static ABICode
--- a/js/src/devtools/vprof/vprof.cpp
+++ b/js/src/devtools/vprof/vprof.cpp
@@ -73,17 +73,17 @@ static long glock = LOCK_IS_FREE;
 
 		printf(buf);
 		::OutputDebugStringA(buf);
 	}
 #else
 	#define vprof_printf printf
 #endif
 
-inline static entry* reverse (entry* s)
+static inline entry* reverse (entry* s)
 {
     entry_t e, n, p;
 
     p = NULL;
     for (e = s; e; e = n) {
         n = e->next;
         e->next = p;
         p = e;
@@ -146,17 +146,17 @@ static void dumpProfile (void)
                 }
             }
         }
         vprof_printf ("\n");
     }
     entries = reverse(entries);
 }
 
-inline static entry_t findEntry (char* file, int line)
+static inline entry_t findEntry (char* file, int line)
 {
     for (entry_t e =  entries; e; e = e->next) {
         if ((e->line == line) && (VMPI_strcmp (e->file, file) == 0)) {
             return e;
         }
     }
     return NULL;
 }
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -131,17 +131,17 @@ MaybeCheckEvalFreeVariables(ExclusiveCon
             }
             scope = scope->enclosingScope();
         }
     }
 
     return true;
 }
 
-inline bool
+static inline bool
 CanLazilyParse(ExclusiveContext *cx, const CompileOptions &options)
 {
     return options.canLazilyParse &&
         options.compileAndGo &&
         options.sourcePolicy == CompileOptions::SAVE_SOURCE &&
         !cx->compartment()->debugMode();
 }
 
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -186,17 +186,17 @@ FoldBinaryNumeric(ExclusiveContext *cx, 
 
 // Remove a ParseNode, **pnp, from a parse tree, putting another ParseNode,
 // *pn, in its place.
 //
 // pnp points to a ParseNode pointer. This must be the only pointer that points
 // to the parse node being replaced. The replacement, *pn, is unchanged except
 // for its pn_next pointer; updating that is necessary if *pn's new parent is a
 // list node.
-void
+static void
 ReplaceNode(ParseNode **pnp, ParseNode *pn)
 {
     pn->pn_next = (*pnp)->pn_next;
     *pnp = pn;
 }
 
 enum Truthiness { Truthy, Falsy, Unknown };
 
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -909,17 +909,17 @@ TokenStream::newToken(ptrdiff_t adjust)
 
 JS_ALWAYS_INLINE JSAtom *
 TokenStream::atomize(ExclusiveContext *cx, CharBuffer &cb)
 {
     return AtomizeChars<CanGC>(cx, cb.begin(), cb.length());
 }
 
 #ifdef DEBUG
-bool
+static bool
 IsTokenSane(Token *tp)
 {
     // Nb: TOK_EOL should never be used in an actual Token;  it should only be
     // returned as a TokenKind from peekTokenSameLine().
     if (tp->type < TOK_ERROR || tp->type >= TOK_LIMIT || tp->type == TOK_EOL)
         return false;
 
     if (tp->pos.end < tp->pos.begin)
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -29,17 +29,17 @@ using namespace mozilla;
 
 template <typename T>
 bool
 CheckNonAddressThing(uintptr_t *w, Rooted<T> *rootp)
 {
     return w >= (uintptr_t*)rootp->address() && w < (uintptr_t*)(rootp->address() + 1);
 }
 
-JS_ALWAYS_INLINE bool
+static JS_ALWAYS_INLINE bool
 CheckStackRootThing(uintptr_t *w, Rooted<void *> *rootp, ThingRootKind kind)
 {
     if (kind == THING_ROOT_BINDINGS)
         return CheckNonAddressThing(w, reinterpret_cast<Rooted<Bindings> *>(rootp));
 
     if (kind == THING_ROOT_PROPERTY_DESCRIPTOR)
         return CheckNonAddressThing(w, reinterpret_cast<Rooted<PropertyDescriptor> *>(rootp));
 
--- a/js/src/gdb/gdb-tests.cpp
+++ b/js/src/gdb/gdb-tests.cpp
@@ -15,25 +15,25 @@ using namespace JS;
 /* The class of the global object. */
 const JSClass global_class = {
     "global", JSCLASS_GLOBAL_FLAGS,
     JS_PropertyStub,  JS_DeletePropertyStub, JS_PropertyStub,  JS_StrictPropertyStub,
     JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
 };
 
 template<typename T>
-inline T *
+static inline T *
 checkPtr(T *ptr)
 {
   if (! ptr)
     abort();
   return ptr;
 }
 
-void
+static void
 checkBool(bool success)
 {
   if (! success)
     abort();
 }
 
 /* The error reporter callback. */
 void reportError(JSContext *cx, const char *message, JSErrorReport *report)
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -229,17 +229,17 @@ IsPhiObservable(MPhi *phi, Observability
         }
     }
     return false;
 }
 
 // Handles cases like:
 //    x is phi(a, x) --> a
 //    x is phi(a, a) --> a
-inline MDefinition *
+static inline MDefinition *
 IsPhiRedundant(MPhi *phi)
 {
     MDefinition *first = phi->operandIfRedundant();
     if (first == nullptr)
         return nullptr;
 
     // Propagate the Folded flag if |phi| is replaced with another phi.
     if (phi->isFolded())
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -7595,38 +7595,38 @@ IonBuilder::jsop_not()
 
     MNot *ins = new MNot(value);
     current->add(ins);
     current->push(ins);
     ins->infer();
     return true;
 }
 
-inline bool
+static inline bool
 TestClassHasAccessorHook(const Class *clasp, bool isGetter)
 {
     if (isGetter && clasp->ops.getGeneric)
         return true;
     if (!isGetter && clasp->ops.setGeneric)
         return true;
     return false;
 }
 
-inline bool
+static inline bool
 TestTypeHasOwnProperty(types::TypeObjectKey *typeObj, PropertyName *name, bool &cont)
 {
     cont = true;
     types::HeapTypeSetKey propSet = typeObj->property(NameToId(name));
     if (!propSet.actualTypes->empty())
         cont = false;
     // Note: Callers must explicitly freeze the property type set later on if optimizing.
     return true;
 }
 
-inline bool
+static inline bool
 TestCommonAccessorProtoChain(JSContext *cx, PropertyName *name,
                              bool isGetter, JSObject *foundProto,
                              JSObject *obj, bool &cont)
 {
     cont = false;
     JSObject *curObj = obj;
     JSObject *stopAt = foundProto->getProto();
     while (curObj != stopAt) {
@@ -7662,17 +7662,17 @@ TestCommonAccessorProtoChain(JSContext *
         }
 
         curObj = curObj->getProto();
     }
     cont = true;
     return true;
 }
 
-inline bool
+static inline bool
 SearchCommonPropFunc(JSContext *cx, types::TemporaryTypeSet *types,
                      PropertyName *name, bool isGetter,
                      JSObject *&found, JSObject *&foundProto, bool &cont)
 {
     cont = false;
     for (unsigned i = 0; i < types->getObjectCount(); i++) {
         RootedObject curObj(cx, types->getSingleObject(i));
 
--- a/js/src/jit/IonCaches.cpp
+++ b/js/src/jit/IonCaches.cpp
@@ -2390,17 +2390,17 @@ GenerateCallSetter(JSContext *cx, IonScr
     JS_ASSERT(masm.framePushed() == initialStack);
 
     // restoreLive()
     masm.PopRegsInMask(liveRegs);
 
     return true;
 }
 
-bool
+static bool
 IsCacheableDOMProxyUnshadowedSetterCall(JSContext *cx, HandleObject obj, HandlePropertyName name,
                                         MutableHandleObject holder, MutableHandleShape shape,
                                         bool *isSetter)
 {
     JS_ASSERT(IsCacheableDOMProxy(obj));
 
     *isSetter = false;
 
--- a/js/src/jit/IonMacroAssembler.cpp
+++ b/js/src/jit/IonMacroAssembler.cpp
@@ -1356,17 +1356,17 @@ MacroAssembler::clearCalleeTag(Register 
       case ParallelExecution:
         andPtr(Imm32(~0x3), callee);
         return;
       default:
         MOZ_ASSUME_UNREACHABLE("No such execution mode");
     }
 }
 
-void printf0_(const char *output) {
+static void printf0_(const char *output) {
     printf("%s", output);
 }
 
 void
 MacroAssembler::printf(const char *output)
 {
     RegisterSet regs = RegisterSet::Volatile();
     PushRegsInMask(regs);
@@ -1376,17 +1376,17 @@ MacroAssembler::printf(const char *outpu
     setupUnalignedABICall(1, temp);
     movePtr(ImmPtr(output), temp);
     passABIArg(temp);
     callWithABI(JS_FUNC_TO_DATA_PTR(void *, printf0_));
 
     PopRegsInMask(RegisterSet::Volatile());
 }
 
-void printf1_(const char *output, uintptr_t value) {
+static void printf1_(const char *output, uintptr_t value) {
     char *line = JS_sprintf_append(nullptr, output, value);
     printf("%s", line);
     js_free(line);
 }
 
 void
 MacroAssembler::printf(const char *output, Register value)
 {
--- a/js/src/jit/ParallelFunctions.cpp
+++ b/js/src/jit/ParallelFunctions.cpp
@@ -50,17 +50,17 @@ jit::IsThreadLocalObject(ForkJoinSlice *
 static void
 printTrace(const char *prefix, struct IonLIRTraceData *cached)
 {
     fprintf(stderr, "%s / Block %3u / LIR %3u / Mode %u / LIR %s\n",
             prefix,
             cached->blockIndex, cached->lirIndex, cached->execModeInt, cached->lirOpName);
 }
 
-struct IonLIRTraceData seqTraceData;
+static struct IonLIRTraceData seqTraceData;
 #endif
 
 void
 jit::TraceLIR(IonLIRTraceData *current)
 {
 #ifdef DEBUG
     static enum { NotSet, All, Bailouts } traceMode;
 
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -2162,17 +2162,17 @@ RemoveTruncatesOnOutput(MInstruction *tr
         MDefinition *def = use.def();
         if (!def->isTruncateToInt32() || !def->isToInt32())
             continue;
 
         def->replaceAllUsesWith(truncated);
     }
 }
 
-void
+static void
 AdjustTruncatedInputs(MInstruction *truncated)
 {
     MBasicBlock *block = truncated->block();
     for (size_t i = 0, e = truncated->numOperands(); i < e; i++) {
         if (!truncated->isOperandTruncated(i))
             continue;
         if (truncated->getOperand(i)->type() == MIRType_Int32)
             continue;
--- a/js/src/jit/arm/Assembler-arm.cpp
+++ b/js/src/jit/arm/Assembler-arm.cpp
@@ -1490,17 +1490,17 @@ Assembler::as_movw(Register dest, Imm16 
 }
 BufferOffset
 Assembler::as_movt(Register dest, Imm16 imm, Condition c, Instruction *pos)
 {
     JS_ASSERT(hasMOVWT());
     return writeInst(0x03400000 | c | imm.encode() | RD(dest), (uint32_t*)pos);
 }
 
-const int mull_tag = 0x90;
+static const int mull_tag = 0x90;
 
 BufferOffset
 Assembler::as_genmul(Register dhi, Register dlo, Register rm, Register rn,
                      MULOp op, SetCond_ sc, Condition c)
 {
 
     return writeInst(RN(dhi) | maybeRD(dlo) | RM(rm) | rn.code() | op | sc | c | mull_tag);
 }
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -3762,17 +3762,17 @@ JS_Enumerate(JSContext *cx, JSObject *ob
 
 /*
  * XXX reverse iterator for properties, unreverse and meld with jsinterp.c's
  *     prop_iterator_class somehow...
  * + preserve the obj->enumerate API while optimizing the native object case
  * + native case here uses a JSShape *, but that iterates in reverse!
  * + so we make non-native match, by reverse-iterating after JS_Enumerating
  */
-const uint32_t JSSLOT_ITER_INDEX = 0;
+static const uint32_t JSSLOT_ITER_INDEX = 0;
 
 static void
 prop_iter_finalize(FreeOp *fop, JSObject *obj)
 {
     void *pdata = obj->getPrivate();
     if (!pdata)
         return;
 
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -128,17 +128,17 @@ js::StringIsArrayIndex(JSLinearString *s
         JS_ASSERT(index <= MAX_ARRAY_INDEX);
         *indexp = index;
         return true;
     }
 
     return false;
 }
 
-bool
+static bool
 DoubleIndexToId(JSContext *cx, double index, MutableHandleId id)
 {
     if (index == uint32_t(index))
         return IndexToId(cx, uint32_t(index), id);
 
     Value tmp = DoubleValue(index);
     return ValueToId<CanGC>(cx, HandleValue::fromMarkedLocation(&tmp), id);
 }
@@ -1432,17 +1432,17 @@ NumDigitsBase10(uint32_t n)
      * Algorithm taken from
      * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
      */
     uint32_t log2 = CeilingLog2(n);
     uint32_t t = log2 * 1233 >> 12;
     return t - (n < powersOf10[t]) + 1;
 }
 
-inline bool
+static inline bool
 CompareLexicographicInt32(JSContext *cx, const Value &a, const Value &b, bool *lessOrEqualp)
 {
     int32_t aint = a.toInt32();
     int32_t bint = b.toInt32();
 
     /*
      * If both numbers are equal ... trivial
      * If only one of both is negative --> arithmetic comparison as char code
@@ -1477,17 +1477,17 @@ CompareLexicographicInt32(JSContext *cx,
             JS_ASSERT((digitsb - digitsa) < ArrayLength(powersOf10));
             *lessOrEqualp = (uint64_t(auint) * powersOf10[digitsb - digitsa] <= uint64_t(buint));
         }
     }
 
     return true;
 }
 
-inline bool
+static inline bool
 CompareSubStringValues(JSContext *cx, const jschar *s1, size_t l1,
                        const jschar *s2, size_t l2, bool *lessOrEqualp)
 {
     if (!JS_CHECK_OPERATION_LIMIT(cx))
         return false;
 
     int32_t result;
     if (!s1 || !s2 || !CompareChars(s1, l1, s2, l2, &result))
@@ -1704,17 +1704,17 @@ MatchNumericComparator(JSContext *cx, co
 
     if (arg0 == 1 && arg1 == 0)
         return Match_RightMinusLeft;
 
     return Match_None;
 }
 
 template<typename K, typename C>
-inline bool
+static inline bool
 MergeSortByKey(K keys, size_t len, K scratch, C comparator, AutoValueVector *vec)
 {
     MOZ_ASSERT(vec->length() >= len);
 
     /* Sort keys. */
     if (!MergeSort(keys, len, scratch, comparator))
         return false;
 
@@ -1997,17 +1997,17 @@ js::array_sort(JSContext *cx, unsigned a
     while (len > n) {
         if (!JS_CHECK_OPERATION_LIMIT(cx) || !DeletePropertyOrThrow(cx, obj, --len))
             return false;
     }
     args.rval().setObject(*obj);
     return true;
 }
 
-JS_ALWAYS_INLINE bool
+static JS_ALWAYS_INLINE bool
 NewbornArrayPushImpl(JSContext *cx, HandleObject obj, const Value &v)
 {
     Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
 
     JS_ASSERT(!v.isMagic());
     JS_ASSERT(arr->lengthIsWritable());
 
     uint32_t length = arr->length();
--- a/js/src/jsbool.cpp
+++ b/js/src/jsbool.cpp
@@ -58,17 +58,17 @@ bool_toSource_impl(JSContext *cx, CallAr
 
     JSString *str = sb.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
-bool
+static bool
 bool_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsBoolean, bool_toSource_impl>(cx, args);
 }
 #endif
 
 JS_ALWAYS_INLINE bool
@@ -77,17 +77,17 @@ bool_toString_impl(JSContext *cx, CallAr
     HandleValue thisv = args.thisv();
     JS_ASSERT(IsBoolean(thisv));
 
     bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as<BooleanObject>().unbox();
     args.rval().setString(js_BooleanToString(cx, b));
     return true;
 }
 
-bool
+static bool
 bool_toString(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsBoolean, bool_toString_impl>(cx, args);
 }
 
 JS_ALWAYS_INLINE bool
 bool_valueOf_impl(JSContext *cx, CallArgs args)
@@ -95,17 +95,17 @@ bool_valueOf_impl(JSContext *cx, CallArg
     HandleValue thisv = args.thisv();
     JS_ASSERT(IsBoolean(thisv));
 
     bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as<BooleanObject>().unbox();
     args.rval().setBoolean(b);
     return true;
 }
 
-bool
+static bool
 bool_valueOf(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsBoolean, bool_valueOf_impl>(cx, args);
 }
 
 static const JSFunctionSpec boolean_methods[] = {
 #if JS_HAS_TOSOURCE
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -95,57 +95,57 @@ using JS::GenericNaN;
  *
  *     setDay
  *     before
  *     after
  *     equals
  *     hashCode
  */
 
-inline double
+static inline double
 Day(double t)
 {
     return floor(t / msPerDay);
 }
 
 static double
 TimeWithinDay(double t)
 {
     double result = fmod(t, msPerDay);
     if (result < 0)
         result += msPerDay;
     return result;
 }
 
 /* ES5 15.9.1.3. */
-inline bool
+static inline bool
 IsLeapYear(double year)
 {
     JS_ASSERT(ToInteger(year) == year);
     return fmod(year, 4) == 0 && (fmod(year, 100) != 0 || fmod(year, 400) == 0);
 }
 
-inline double
+static inline double
 DaysInYear(double year)
 {
     if (!IsFinite(year))
         return GenericNaN();
     return IsLeapYear(year) ? 366 : 365;
 }
 
-inline double
+static inline double
 DayFromYear(double y)
 {
     return 365 * (y - 1970) +
            floor((y - 1969) / 4.0) -
            floor((y - 1901) / 100.0) +
            floor((y - 1601) / 400.0);
 }
 
-inline double
+static inline double
 TimeFromYear(double y)
 {
     return DayFromYear(y) * msPerDay;
 }
 
 static double
 YearFromTime(double t)
 {
@@ -166,24 +166,24 @@ YearFromTime(double t)
         y--;
     } else {
         if (t2 + msPerDay * DaysInYear(y) <= t)
             y++;
     }
     return y;
 }
 
-inline int
+static inline int
 DaysInFebruary(double year)
 {
     return IsLeapYear(year) ? 29 : 28;
 }
 
 /* ES5 15.9.1.4. */
-inline double
+static inline double
 DayWithinYear(double t, double year)
 {
     JS_ASSERT_IF(IsFinite(t), YearFromTime(t) == year);
     return Day(t) - DayFromYear(year);
 }
 
 static double
 MonthFromTime(double t)
@@ -277,34 +277,34 @@ WeekDay(double t)
      */
     JS_ASSERT(ToInteger(t) == t);
     int result = (int(Day(t)) + 4) % 7;
     if (result < 0)
         result += 7;
     return result;
 }
 
-inline int
+static inline int
 DayFromMonth(int month, bool isLeapYear)
 {
     /*
      * The following array contains the day of year for the first day of
      * each month, where index 0 is January, and day 0 is January 1.
      */
     static const int firstDayOfMonth[2][13] = {
         {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
         {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
     };
 
     JS_ASSERT(0 <= month && month <= 12);
     return firstDayOfMonth[isLeapYear][month];
 }
 
 template<typename T>
-inline int
+static inline int
 DayFromMonth(T month, bool isLeapYear) MOZ_DELETE;
 
 /* ES5 15.9.1.12 (out of order to accommodate DaylightSavingTA). */
 static double
 MakeDay(double year, double month, double date)
 {
     /* Step 1. */
     if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date))
@@ -328,17 +328,17 @@ MakeDay(double year, double month, doubl
 
     double yearday = floor(TimeFromYear(ym) / msPerDay);
     double monthday = DayFromMonth(mn, leap);
 
     return yearday + monthday + dt - 1;
 }
 
 /* ES5 15.9.1.13 (out of order to accommodate DaylightSavingTA). */
-inline double
+static inline double
 MakeDate(double day, double time)
 {
     /* Step 1. */
     if (!IsFinite(day) || !IsFinite(time))
         return GenericNaN();
 
     /* Step 2. */
     return day * msPerDay + time;
--- a/js/src/jsdtoa.cpp
+++ b/js/src/jsdtoa.cpp
@@ -39,18 +39,18 @@ using namespace js;
 #define ULlong uint64_t
 #endif
 */
 
 /*
  * MALLOC gets declared external, and that doesn't work for class members, so
  * wrap.
  */
-inline void* dtoa_malloc(size_t size) { return js_malloc(size); }
-inline void dtoa_free(void* p) { return js_free(p); }
+static inline void* dtoa_malloc(size_t size) { return js_malloc(size); }
+static inline void dtoa_free(void* p) { return js_free(p); }
 
 #define NO_GLOBAL_STATE
 #define NO_ERRNO
 #define MALLOC dtoa_malloc
 #define FREE dtoa_free
 #include "dtoa.c"
 
 /* Mapping of JSDToStrMode -> js_dtoa mode */
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -2450,17 +2450,17 @@ TypeObject::matchDefiniteProperties(Hand
             if (!found)
                 return false;
         }
     }
 
     return true;
 }
 
-inline void
+static inline void
 InlineAddTypeProperty(ExclusiveContext *cx, TypeObject *obj, jsid id, Type type)
 {
     JS_ASSERT(id == IdToTypeId(id));
 
     AutoEnterAnalysis enter(cx);
 
     TypeSet *types = obj->getProperty(cx, id);
     if (!types || types->hasType(type))
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -802,17 +802,17 @@ iterator_next_impl(JSContext *cx, CallAr
     if (!args.rval().toBoolean()) {
         js_ThrowStopIteration(cx);
         return false;
     }
 
     return js_IteratorNext(cx, thisObj, args.rval());
 }
 
-bool
+static bool
 iterator_next(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsIterator, iterator_next_impl>(cx, args);
 }
 
 static const JSFunctionSpec iterator_methods[] = {
     JS_SELF_HOSTED_FN("@@iterator", "LegacyIteratorShim", 0, 0),
@@ -867,17 +867,17 @@ const Class PropertyIteratorObject::clas
     trace,
     {
         nullptr,             /* outerObject    */
         nullptr,             /* innerObject    */
         iterator_iteratorObject,
     }
 };
 
-const uint32_t CLOSED_INDEX = UINT32_MAX;
+static const uint32_t CLOSED_INDEX = UINT32_MAX;
 
 JSObject *
 ElementIteratorObject::create(JSContext *cx, Handle<Value> target)
 {
     RootedObject proto(cx, cx->global()->getOrCreateElementIteratorPrototype(cx));
     if (!proto)
         return nullptr;
     RootedObject iterobj(cx, NewObjectWithGivenProto(cx, &class_, proto, cx->global()));
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -895,17 +895,17 @@ js::math_tan(JSContext *cx, unsigned arg
     args.rval().setDouble(z);
     return true;
 }
 
 
 typedef double (*UnaryMathFunctionType)(MathCache *cache, double);
 
 template <UnaryMathFunctionType F>
-bool math_function(JSContext *cx, unsigned argc, Value *vp)
+static bool math_function(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() == 0) {
         args.rval().setNumber(GenericNaN());
         return true;
     }
 
     double x;
@@ -1362,17 +1362,17 @@ js::math_trunc_uncached(double x)
 }
 
 bool
 js::math_trunc(JSContext *cx, unsigned argc, Value *vp)
 {
     return math_function<math_trunc_impl>(cx, argc, vp);
 }
 
-double sign(double x)
+static double sign(double x)
 {
     if (mozilla::IsNaN(x))
         return GenericNaN();
 
     return x == 0 ? x : x < 0 ? -1 : 1;
 }
 
 double
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -489,17 +489,17 @@ Number(JSContext *cx, unsigned argc, Val
 }
 
 JS_ALWAYS_INLINE bool
 IsNumber(HandleValue v)
 {
     return v.isNumber() || (v.isObject() && v.toObject().is<NumberObject>());
 }
 
-inline double
+static inline double
 Extract(const Value &v)
 {
     if (v.isNumber())
         return v.toNumber();
     return v.toObject().as<NumberObject>().unbox();
 }
 
 #if JS_HAS_TOSOURCE
@@ -848,17 +848,17 @@ num_toLocaleString_impl(JSContext *cx, C
     js_free(buf);
     if (!str)
         return false;
 
     args.rval().setString(str);
     return true;
 }
 
-bool
+static bool
 num_toLocaleString(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args);
 }
 #endif /* !EXPOSE_INTL_API */
 
 JS_ALWAYS_INLINE bool
@@ -871,17 +871,17 @@ num_valueOf_impl(JSContext *cx, CallArgs
 
 bool
 js_num_valueOf(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_valueOf_impl>(cx, args);
 }
 
-const unsigned MAX_PRECISION = 100;
+static const unsigned MAX_PRECISION = 100;
 
 static bool
 ComputePrecisionInRange(JSContext *cx, int minPrecision, int maxPrecision, HandleValue v,
                         int *precision)
 {
     double prec;
     if (!ToInteger(cx, v, &prec))
         return false;
@@ -927,17 +927,17 @@ num_toFixed_impl(JSContext *cx, CallArgs
     } else {
         if (!ComputePrecisionInRange(cx, -20, MAX_PRECISION, args[0], &precision))
             return false;
     }
 
     return DToStrResult(cx, Extract(args.thisv()), DTOSTR_FIXED, precision, args);
 }
 
-bool
+static bool
 num_toFixed(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toFixed_impl>(cx, args);
 }
 
 JS_ALWAYS_INLINE bool
 num_toExponential_impl(JSContext *cx, CallArgs args)
@@ -953,17 +953,17 @@ num_toExponential_impl(JSContext *cx, Ca
         mode = DTOSTR_EXPONENTIAL;
         if (!ComputePrecisionInRange(cx, 0, MAX_PRECISION, args[0], &precision))
             return false;
     }
 
     return DToStrResult(cx, Extract(args.thisv()), mode, precision + 1, args);
 }
 
-bool
+static bool
 num_toExponential(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toExponential_impl>(cx, args);
 }
 
 JS_ALWAYS_INLINE bool
 num_toPrecision_impl(JSContext *cx, CallArgs args)
@@ -991,17 +991,17 @@ num_toPrecision_impl(JSContext *cx, Call
         mode = DTOSTR_PRECISION;
         if (!ComputePrecisionInRange(cx, 1, MAX_PRECISION, args[0], &precision))
             return false;
     }
 
     return DToStrResult(cx, d, mode, precision, args);
 }
 
-bool
+static bool
 num_toPrecision(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toPrecision_impl>(cx, args);
 }
 
 static const JSFunctionSpec number_methods[] = {
 #if JS_HAS_TOSOURCE
@@ -1122,17 +1122,17 @@ static JSConstDoubleSpec number_constant
 
 #if (defined __GNUC__ && defined __i386__) || \
     (defined __SUNPRO_CC && defined __i386)
 
 /*
  * Set the exception mask to mask all exceptions and set the FPU precision
  * to 53 bit mantissa (64 bit doubles).
  */
-inline void FIX_FPU() {
+static inline void FIX_FPU() {
     short control;
     asm("fstcw %0" : "=m" (control) : );
     control &= ~0x300; // Lower bits 8 and 9 (precision control).
     control |= 0x2f3;  // Raise bits 0-5 (exception masks) and 9 (64-bit precision).
     asm("fldcw %0" : : "m" (control) );
 }
 
 #else
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2812,28 +2812,28 @@ JSObject::maybeDensifySparseElements(js:
      * to grow the object.
      */
     if (!obj->clearFlag(cx, BaseShape::INDEXED))
         return ED_FAILED;
 
     return ED_OK;
 }
 
-ObjectElements *
+static ObjectElements *
 AllocateElements(ThreadSafeContext *cx, JSObject *obj, uint32_t nelems)
 {
 #ifdef JSGC_GENERATIONAL
     if (cx->isJSContext())
         return cx->asJSContext()->runtime()->gcNursery.allocateElements(cx->asJSContext(), obj, nelems);
 #endif
 
     return static_cast<js::ObjectElements *>(cx->malloc_(nelems * sizeof(HeapValue)));
 }
 
-ObjectElements *
+static ObjectElements *
 ReallocateElements(ThreadSafeContext *cx, JSObject *obj, ObjectElements *oldHeader,
                    uint32_t oldCount, uint32_t newCount)
 {
 #ifdef JSGC_GENERATIONAL
     if (cx->isJSContext()) {
         return cx->asJSContext()->runtime()-> gcNursery.reallocateElements(cx->asJSContext(), obj, oldHeader,
                                                                            oldCount, newCount);
     }
@@ -5376,17 +5376,17 @@ js_GetterOnlyPropertyStub(JSContext *cx,
 #ifdef DEBUG
 
 /*
  * Routines to print out values during debugging.  These are FRIEND_API to help
  * the debugger find them and to support temporarily hacking js_Dump* calls
  * into other code.
  */
 
-void
+static void
 dumpValue(const Value &v)
 {
     if (v.isNull())
         fprintf(stderr, "null");
     else if (v.isUndefined())
         fprintf(stderr, "undefined");
     else if (v.isInt32())
         fprintf(stderr, "%d", v.toInt32());
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -503,17 +503,17 @@ str_toSource_impl(JSContext *cx, CallArg
 
     str = sb.finishString();
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 
-bool
+static bool
 str_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsString, str_toSource_impl>(cx, args);
 }
 
 #endif /* JS_HAS_TOSOURCE */
 
@@ -534,17 +534,17 @@ js_str_toString(JSContext *cx, unsigned 
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsString, str_toString_impl>(cx, args);
 }
 
 /*
  * Java-like string native methods.
  */
 
-JS_ALWAYS_INLINE bool
+static JS_ALWAYS_INLINE bool
 ValueToIntegerRange(JSContext *cx, HandleValue v, int32_t *out)
 {
     if (v.isInt32()) {
         *out = v.toInt32();
     } else {
         double d;
         if (!ToInteger(cx, v, &d))
             return false;
--- a/js/src/jsutil.h
+++ b/js/src/jsutil.h
@@ -191,17 +191,17 @@ ComputeByteAlignment(T bytes, U alignmen
 
 template <typename T, typename U>
 static inline T
 AlignBytes(T bytes, U alignment)
 {
     return bytes + ComputeByteAlignment(bytes, alignment);
 }
 
-JS_ALWAYS_INLINE static size_t
+static JS_ALWAYS_INLINE size_t
 UnsignedPtrDiff(const void *bigger, const void *smaller)
 {
     return size_t(bigger) - size_t(smaller);
 }
 
 /*****************************************************************************/
 
 /* A bit array is an array of bits represented by an array of words (size_t). */
--- a/js/src/perf/jsperf.cpp
+++ b/js/src/perf/jsperf.cpp
@@ -91,26 +91,26 @@ pm_canMeasureSomething(JSContext* cx, un
     PerfMeasurement* p = GetPM(cx, args.thisv(), "canMeasureSomething");
     if (!p)
         return false;
 
     args.rval().setBoolean(p->canMeasureSomething());
     return true;
 }
 
-const uint8_t PM_FATTRS = JSPROP_READONLY | JSPROP_PERMANENT;
+static const uint8_t PM_FATTRS = JSPROP_READONLY | JSPROP_PERMANENT;
 static const JSFunctionSpec pm_fns[] = {
     JS_FN("start",               pm_start,               0, PM_FATTRS),
     JS_FN("stop",                pm_stop,                0, PM_FATTRS),
     JS_FN("reset",               pm_reset,               0, PM_FATTRS),
     JS_FN("canMeasureSomething", pm_canMeasureSomething, 0, PM_FATTRS),
     JS_FS_END
 };
 
-const uint8_t PM_PATTRS =
+static const uint8_t PM_PATTRS =
     JSPROP_ENUMERATE | JSPROP_PERMANENT;
 
 #define GETTER(name)                            \
     JS_PSG(#name, pm_get_##name, PM_PATTRS)
 
 static const JSPropertySpec pm_props[] = {
     GETTER(cpu_cycles),
     GETTER(instructions),
@@ -126,17 +126,17 @@ static const JSPropertySpec pm_props[] =
     GETTER(eventsMeasured),
     JS_PS_END
 };
 
 #undef GETTER
 
 // If this were C++ these would be "static const" members.
 
-const uint8_t PM_CATTRS = JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT;
+static const uint8_t PM_CATTRS = JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT;
 
 #define CONSTANT(name) { #name, PerfMeasurement::name }
 
 static const struct pm_const {
     const char *name;
     PerfMeasurement::EventMask value;
 } pm_consts[] = {
     CONSTANT(CPU_CYCLES),
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -80,17 +80,17 @@ extern const Class DebuggerSource_class;
 enum {
     JSSLOT_DEBUGSOURCE_OWNER,
     JSSLOT_DEBUGSOURCE_COUNT
 };
 
 
 /*** Utils ***************************************************************************************/
 
-bool
+static bool
 ReportMoreArgsNeeded(JSContext *cx, const char *name, unsigned required)
 {
     JS_ASSERT(required > 0);
     JS_ASSERT(required <= 10);
     char s[2];
     s[0] = '0' + (required - 1);
     s[1] = '\0';
     JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
@@ -99,24 +99,24 @@ ReportMoreArgsNeeded(JSContext *cx, cons
 }
 
 #define REQUIRE_ARGC(name, n)                                                 \
     JS_BEGIN_MACRO                                                            \
         if (argc < (n))                                                       \
             return ReportMoreArgsNeeded(cx, name, n);                         \
     JS_END_MACRO
 
-bool
+static bool
 ReportObjectRequired(JSContext *cx)
 {
     JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT);
     return false;
 }
 
-bool
+static bool
 ValueToIdentifier(JSContext *cx, HandleValue v, MutableHandleId id)
 {
     if (!ValueToId<CanGC>(cx, v, id))
         return false;
     if (!JSID_IS_ATOM(id) || !IsIdentifier(JSID_TO_ATOM(id))) {
         RootedValue val(cx, v);
         js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
                                  JSDVG_SEARCH_STACK, val, NullPtr(), "not an identifier",
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -220,17 +220,17 @@ NoSuchMethod(JSContext *cx, unsigned arg
     args[1].setObject(*argsobj);
     bool ok = Invoke(cx, args);
     vp[0] = args.rval();
     return ok;
 }
 
 #endif /* JS_HAS_NO_SUCH_METHOD */
 
-inline bool
+static inline bool
 GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytecode *pc,
                      MutableHandleValue lval, MutableHandleValue vp)
 {
     JSOp op = JSOp(*pc);
 
     if (op == JSOP_LENGTH) {
         if (IsOptimizedArguments(fp, lval.address())) {
             vp.setInt32(fp->numActualArgs());
@@ -311,17 +311,17 @@ NameOperation(JSContext *cx, StackFrame 
 
     /* Kludge to allow (typeof foo == "undefined") tests. */
     JSOp op2 = JSOp(pc[JSOP_NAME_LENGTH]);
     if (op2 == JSOP_TYPEOF)
         return FetchName<true>(cx, scopeRoot, pobjRoot, nameRoot, shapeRoot, vp);
     return FetchName<false>(cx, scopeRoot, pobjRoot, nameRoot, shapeRoot, vp);
 }
 
-inline bool
+static inline bool
 SetPropertyOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleValue lval,
                      HandleValue rval)
 {
     JS_ASSERT(*pc == JSOP_SETPROP);
 
     RootedObject obj(cx, ToObjectFromStack(cx, lval));
     if (!obj)
         return false;
@@ -1056,17 +1056,17 @@ FrameGuard::~FrameGuard()
  * If the callee is a strict mode function, then code implementing JSOP_THIS
  * in the interpreter and JITs will leave undefined as |this|. If funval is a
  * function not in strict mode, JSOP_THIS code replaces undefined with funval's
  * global.
  *
  * We set *vp to undefined early to reduce code size and bias this code for the
  * common and future-friendly cases.
  */
-inline bool
+static inline bool
 ComputeImplicitThis(JSContext *cx, HandleObject obj, MutableHandleValue vp)
 {
     vp.setUndefined();
 
     if (obj->is<GlobalObject>())
         return true;
 
     if (IsCacheableNonGlobalScope(obj))
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -525,17 +525,17 @@ intrinsic_RuntimeDefaultLocale(JSContext
     RootedString jslocale(cx, JS_NewStringCopyZ(cx, locale));
     if (!jslocale)
         return false;
 
     args.rval().setString(jslocale);
     return true;
 }
 
-const JSFunctionSpec intrinsic_functions[] = {
+static const JSFunctionSpec intrinsic_functions[] = {
     JS_FN("ToObject",                intrinsic_ToObject,                1,0),
     JS_FN("ToInteger",               intrinsic_ToInteger,               1,0),
     JS_FN("IsCallable",              intrinsic_IsCallable,              1,0),
     JS_FN("ThrowError",              intrinsic_ThrowError,              4,0),
     JS_FN("AssertionFailed",         intrinsic_AssertionFailed,         1,0),
     JS_FN("SetScriptHints",          intrinsic_SetScriptHints,          2,0),
     JS_FN("MakeConstructible",       intrinsic_MakeConstructible,       1,0),
     JS_FN("MakeWrappable",           intrinsic_MakeWrappable,           1,0),
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -674,17 +674,17 @@ JSObject::addPropertyInternal<ParallelEx
                                                  unsigned flags, int shortid, Shape **spp,
                                                  bool allowDictionary);
 
 /*
  * Check and adjust the new attributes for the shape to make sure that our
  * slot access optimizations are sound. It is responsibility of the callers to
  * enforce all restrictions from ECMA-262 v5 8.12.9 [[DefineOwnProperty]].
  */
-inline bool
+static inline bool
 CheckCanChangeAttrs(ThreadSafeContext *cx, JSObject *obj, Shape *shape, unsigned *attrsp)
 {
     if (shape->configurable())
         return true;
 
     /* A permanent property must stay permanent. */
     *attrsp |= JSPROP_PERMANENT;
 
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -379,29 +379,29 @@ CloneNonReflectorsWrite(JSContext *cx, J
             return true;
         }
     }
 
     JS_ReportError(cx, "CloneNonReflectorsWrite error");
     return false;
 }
 
-const JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
+static const JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
     CloneNonReflectorsRead,
     CloneNonReflectorsWrite,
     nullptr
 };
 
 /*
  * This is a special structured cloning, that clones only non-reflectors.
  * The function assumes the cx is already entered the compartment we want
  * to clone to, and that if val is an object is from the compartment we
  * clone from.
  */
-bool
+static bool
 CloneNonReflectors(JSContext *cx, MutableHandleValue val)
 {
     JSAutoStructuredCloneBuffer buffer;
     AutoObjectVector rootedReflectors(cx);
     {
         // For parsing val we have to enter its compartment.
         // (unless it's a primitive)
         Maybe<JSAutoCompartment> ac;
@@ -1624,17 +1624,17 @@ xpc::EvalInSandbox(JSContext *cx, Handle
     }
     NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
 
     // Whew!
     rval.set(v);
     return NS_OK;
 }
 
-bool
+static bool
 NonCloningFunctionForwarder(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedValue v(cx, js::GetFunctionNativeReserved(&args.callee(), 0));
     MOZ_ASSERT(v.isObject(), "weird function");
 
     JSObject *obj = JS_THIS_OBJECT(cx, vp);
@@ -1643,17 +1643,17 @@ NonCloningFunctionForwarder(JSContext *c
     }
     return JS_CallFunctionValue(cx, obj, v, args.length(), args.array(), vp);
 }
 
 /*
  * Forwards the call to the exported function. Clones all the non reflectors, ignores
  * the |this| argument.
  */
-bool
+static bool
 CloningFunctionForwarder(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedValue v(cx, js::GetFunctionNativeReserved(&args.callee(), 0));
     NS_ASSERTION(v.isObject(), "weird function");
     RootedObject origFunObj(cx, UncheckedUnwrap(&v.toObject()));
     {
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -3256,24 +3256,24 @@ nsXPCComponents_Utils::CanGetProperty(co
 NS_IMETHODIMP
 nsXPCComponents_Utils::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
 {
     // If you have to ask, then the answer is NO
     *_retval = nullptr;
     return NS_OK;
 }
 
-nsresult
+static nsresult
 GetBoolOption(JSContext* cx, uint32_t aOption, bool* aValue)
 {
     *aValue = !!(JS_GetOptions(cx) & aOption);
     return NS_OK;
 }
 
-nsresult
+static nsresult
 SetBoolOption(JSContext* cx, uint32_t aOption, bool aValue)
 {
     uint32_t options = JS_GetOptions(cx);
     if (aValue) {
         options |= aOption;
     } else {
         options &= ~aOption;
     }
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -765,17 +765,17 @@ XPCConvert::JSData2Native(void* d, Handl
     }
     default:
         NS_ERROR("bad type");
         return false;
     }
     return true;
 }
 
-inline bool
+static inline bool
 CreateHolderIfNeeded(HandleObject obj, jsval* d,
                      nsIXPConnectJSObjectHolder** dest)
 {
     if (dest) {
         XPCJSObjectHolder* objHolder = XPCJSObjectHolder::newHolder(obj);
         if (!objHolder)
             return false;
 
--- a/js/xpconnect/src/XPCQuickStubs.cpp
+++ b/js/xpconnect/src/XPCQuickStubs.cpp
@@ -491,17 +491,17 @@ getNative(nsISupports *idobj,
 {
     nsresult rv = idobj->QueryInterface(iid, ppThis);
     *pThisRef = static_cast<nsISupports*>(*ppThis);
     if (NS_SUCCEEDED(rv))
         *vp = OBJECT_TO_JSVAL(obj);
     return rv;
 }
 
-inline nsresult
+static inline nsresult
 getNativeFromWrapper(JSContext *cx,
                      XPCWrappedNative *wrapper,
                      const nsIID &iid,
                      void **ppThis,
                      nsISupports **pThisRef,
                      jsval *vp)
 {
     RootedObject obj(cx, wrapper->GetFlatJSObject());
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -96,28 +96,28 @@ private:
 #define DoEndRequest(cx)   ((void)0)
 #endif
 
 static const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect;1";
 
 #define EXITCODE_RUNTIME_ERROR 3
 #define EXITCODE_FILE_NOT_FOUND 4
 
-FILE *gOutFile = NULL;
-FILE *gErrFile = NULL;
-FILE *gInFile = NULL;
+static FILE *gOutFile = NULL;
+static FILE *gErrFile = NULL;
+static FILE *gInFile = NULL;
 
-int gExitCode = 0;
-bool gIgnoreReportedErrors = false;
-bool gQuitting = false;
+static int gExitCode = 0;
+static bool gIgnoreReportedErrors = false;
+static bool gQuitting = false;
 static bool reportWarnings = true;
 static bool compileOnly = false;
 
-JSPrincipals *gJSPrincipals = nullptr;
-nsAutoString *gWorkingDirectory = nullptr;
+static JSPrincipals *gJSPrincipals = nullptr;
+static nsAutoString *gWorkingDirectory = nullptr;
 
 static bool
 GetLocationProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
 {
 #if !defined(XP_WIN) && !defined(XP_UNIX)
     //XXX: your platform should really implement this
     return false;
 #else
@@ -748,17 +748,17 @@ File(JSContext *cx, unsigned argc, jsval
   if (NS_FAILED(rv)) {
     JS_ReportError(cx, "Could not wrap native object!");
     return false;
   }
 
   return true;
 }
 
-Value sScriptedOperationCallback = UndefinedValue();
+static Value sScriptedOperationCallback = UndefinedValue();
 
 static bool
 XPCShellOperationCallback(JSContext *cx)
 {
     // If no operation callback was set by script, no-op.
     if (sScriptedOperationCallback.isUndefined())
         return true;
 
@@ -973,17 +973,17 @@ static const JSClass env_class = {
 typedef enum JSShellErrNum {
 #define MSG_DEF(name, number, count, exception, format) \
     name = number,
 #include "jsshell.msg"
 #undef MSG_DEF
     JSShellErr_Limit
 } JSShellErrNum;
 
-const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
+static const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
 #define MSG_DEF(name, number, count, exception, format) \
     { format, count } ,
 #include "jsshell.msg"
 #undef MSG_DEF
 };
 
 static const JSErrorFormatString *
 my_GetErrorMessage(void *userRef, const char *locale, const unsigned errorNumber)
@@ -1378,17 +1378,17 @@ nsXPCFunctionThisTranslator::TranslateTh
 {
     NS_IF_ADDREF(aInitialThis);
     *_retval = aInitialThis;
     return NS_OK;
 }
 
 #endif
 
-void
+static void
 XPCShellErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep)
 {
     if (gIgnoreReportedErrors)
         return;
 
     if (!JSREPORT_IS_WARNING(rep->flags))
         gExitCode = EXITCODE_RUNTIME_ERROR;
 
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2886,17 +2886,17 @@ NS_IMETHODIMP XPCWrappedNative::FindInte
 NS_IMETHODIMP_(bool)
 XPCWrappedNative::HasNativeMember(HandleId name)
 {
     XPCNativeMember *member = nullptr;
     uint16_t ignored;
     return GetSet()->FindMember(name, &member, &ignored) && !!member;
 }
 
-inline nsresult UnexpectedFailure(nsresult rv)
+static inline nsresult UnexpectedFailure(nsresult rv)
 {
     NS_ERROR("This is not supposed to fail!");
     return rv;
 }
 
 /* void finishInitForWrappedGlobal (); */
 NS_IMETHODIMP XPCWrappedNative::FinishInitForWrappedGlobal()
 {
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -328,17 +328,17 @@ xpc_TryUnmarkWrappedGrayObject(nsISuppor
         static_cast<nsXPCWrappedJS*>(wjs.get())->GetJSObject();
     }
 }
 
 /***************************************************************************/
 /***************************************************************************/
 // nsIXPConnect interface methods...
 
-inline nsresult UnexpectedFailure(nsresult rv)
+static inline nsresult UnexpectedFailure(nsresult rv)
 {
     NS_ERROR("This is not supposed to fail!");
     return rv;
 }
 
 /* void initClasses (in JSContextPtr aJSContext, in JSObjectPtr aGlobalJSObj); */
 NS_IMETHODIMP
 nsXPConnect::InitClasses(JSContext * aJSContext, JSObject * aGlobalJSObj)
@@ -1464,18 +1464,18 @@ nsXPConnect::GetTelemetryValue(JSContext
 
 NS_IMETHODIMP
 nsXPConnect::NotifyDidPaint()
 {
     JS::NotifyDidPaint(GetRuntime()->Runtime());
     return NS_OK;
 }
 
-const uint8_t HAS_PRINCIPALS_FLAG               = 1;
-const uint8_t HAS_ORIGIN_PRINCIPALS_FLAG        = 2;
+static const uint8_t HAS_PRINCIPALS_FLAG               = 1;
+static const uint8_t HAS_ORIGIN_PRINCIPALS_FLAG        = 2;
 
 static nsresult
 WriteScriptOrFunction(nsIObjectOutputStream *stream, JSContext *cx,
                       JSScript *scriptArg, HandleObject functionObj)
 {
     // Exactly one of script or functionObj must be given
     MOZ_ASSERT(!scriptArg != !functionObj);