Bug 1137523 - Unprefix most js_* functions. r=bhackett CLOSED TREE
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 27 Feb 2015 16:08:15 +0100
changeset 231133 069853eac6ccf1b771bddec4f6e3c389686b08cf
parent 231132 27f56cce61829ff560b7f4eac1791ba231d4958f
child 231134 e3138fd47c7d863965991c7e223e8a9fa80ef92a
push id28344
push userryanvm@gmail.com
push dateFri, 27 Feb 2015 18:20:08 +0000
treeherdermozilla-central@9dd9d1e5b43c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs1137523
milestone39.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 1137523 - Unprefix most js_* functions. r=bhackett CLOSED TREE
dom/bindings/BindingUtils.cpp
dom/bindings/DOMJSProxyHandler.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/system/OSFileConstants.cpp
dom/workers/WorkerScope.cpp
js/ipc/JavaScriptLogging.h
js/ipc/WrapperAnswer.cpp
js/public/Proxy.h
js/src/asmjs/AsmJSLink.cpp
js/src/asmjs/AsmJSModule.cpp
js/src/asmjs/AsmJSValidate.cpp
js/src/builtin/AtomicsObject.cpp
js/src/builtin/AtomicsObject.h
js/src/builtin/Eval.cpp
js/src/builtin/Intl.cpp
js/src/builtin/Intl.h
js/src/builtin/MapObject.cpp
js/src/builtin/MapObject.h
js/src/builtin/Object.cpp
js/src/builtin/RegExp.cpp
js/src/builtin/RegExp.h
js/src/builtin/SIMD.cpp
js/src/builtin/SIMD.h
js/src/builtin/SymbolObject.cpp
js/src/builtin/SymbolObject.h
js/src/builtin/TestingFunctions.cpp
js/src/builtin/TypedObject.cpp
js/src/builtin/TypedObject.h
js/src/builtin/WeakSetObject.cpp
js/src/builtin/WeakSetObject.h
js/src/ctypes/CTypes.cpp
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/NameFunctions.cpp
js/src/frontend/ParseMaps.cpp
js/src/frontend/ParseNode.cpp
js/src/frontend/Parser.cpp
js/src/frontend/TokenStream.cpp
js/src/gc/Marking.cpp
js/src/gc/Zone.h
js/src/irregexp/RegExpInterpreter.cpp
js/src/jit/BaselineIC.cpp
js/src/jit/Ion.cpp
js/src/jit/IonAnalysis.cpp
js/src/jit/IonBuilder.cpp
js/src/jit/JitFrames.cpp
js/src/jit/Linker.h
js/src/jit/MCallOptimize.cpp
js/src/jit/MacroAssembler.cpp
js/src/jit/arm/Simulator-arm.h
js/src/jit/mips/Simulator-mips.h
js/src/jsalloc.cpp
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsarray.h
js/src/jsatom.cpp
js/src/jsbool.cpp
js/src/jsbool.h
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jscompartment.cpp
js/src/jsdate.cpp
js/src/jsdate.h
js/src/jsdtoa.cpp
js/src/jsdtoa.h
js/src/jsexn.cpp
js/src/jsexn.h
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsgc.cpp
js/src/jsgc.h
js/src/jsgcinlines.h
js/src/jsiter.cpp
js/src/jsiter.h
js/src/jsmath.cpp
js/src/jsmath.h
js/src/jsnum.cpp
js/src/jsnum.h
js/src/jsobj.cpp
js/src/jsobj.h
js/src/jsobjinlines.h
js/src/json.cpp
js/src/json.h
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jspropertytree.cpp
js/src/jsprototypes.h
js/src/jspubtd.h
js/src/jsreflect.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/jswatchpoint.cpp
js/src/jsweakmap.cpp
js/src/jsweakmap.h
js/src/perf/jsperf.cpp
js/src/proxy/BaseProxyHandler.cpp
js/src/proxy/DeadObjectProxy.cpp
js/src/proxy/Proxy.cpp
js/src/proxy/ScriptedDirectProxyHandler.cpp
js/src/proxy/ScriptedIndirectProxyHandler.cpp
js/src/proxy/SecurityWrapper.cpp
js/src/proxy/Wrapper.cpp
js/src/shell/js.cpp
js/src/shell/jsheaptools.cpp
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ArrayBufferObject.h
js/src/vm/BooleanObject.h
js/src/vm/CharacterEncoding.cpp
js/src/vm/Debugger.cpp
js/src/vm/DebuggerMemory.cpp
js/src/vm/ErrorObject.h
js/src/vm/ForOfIterator.cpp
js/src/vm/GeneratorObject.cpp
js/src/vm/GlobalObject.cpp
js/src/vm/GlobalObject.h
js/src/vm/HelperThreads.cpp
js/src/vm/Interpreter-inl.h
js/src/vm/Interpreter.cpp
js/src/vm/Interpreter.h
js/src/vm/JSONParser.cpp
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.cpp
js/src/vm/NumberObject.h
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpStatics.h
js/src/vm/Runtime.cpp
js/src/vm/Runtime.h
js/src/vm/SavedStacks.cpp
js/src/vm/ScopeObject.cpp
js/src/vm/ScopeObject.h
js/src/vm/SelfHosting.cpp
js/src/vm/Shape-inl.h
js/src/vm/Shape.cpp
js/src/vm/SharedArrayObject.cpp
js/src/vm/SharedTypedArrayObject.cpp
js/src/vm/Stack-inl.h
js/src/vm/String-inl.h
js/src/vm/StringBuffer.cpp
js/src/vm/StringObject.h
js/src/vm/StructuredClone.cpp
js/src/vm/Symbol.cpp
js/src/vm/TypeInference-inl.h
js/src/vm/TypeInference.cpp
js/src/vm/TypedArrayCommon.h
js/src/vm/TypedArrayObject.cpp
js/src/vm/TypedArrayObject.h
js/src/vm/Xdr.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.h
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -402,17 +402,17 @@ DefineUnforgeableAttributes(JSContext* c
 // passed a non-Function object we also need to provide our own toString method
 // for interface objects.
 
 static bool
 InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
   if (!args.thisv().isObject()) {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
                          JSMSG_CANT_CONVERT_TO, "null", "object");
     return false;
   }
 
   JS::Rooted<JSObject*> thisObj(cx, &args.thisv().toObject());
   JS::Rooted<JSObject*> obj(cx, js::CheckedUnwrap(thisObj, /* stopAtOuter = */ false));
   if (!obj) {
     JS_ReportError(cx, "Permission denied to access object");
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -197,31 +197,31 @@ BaseDOMProxyHandler::getOwnPropertyDescr
 bool
 DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
                                 MutableHandle<JSPropertyDescriptor> desc, bool* defined) const
 {
   if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) {
     return JS_ReportErrorFlagsAndNumber(cx,
                                         JSREPORT_WARNING | JSREPORT_STRICT |
                                         JSREPORT_STRICT_MODE_ERROR,
-                                        js_GetErrorMessage, nullptr,
+                                        js::GetErrorMessage, nullptr,
                                         JSMSG_GETTER_ONLY);
   }
 
   if (xpc::WrapperFactory::IsXrayWrapper(proxy)) {
     return true;
   }
 
   JSObject* expando = EnsureExpandoObject(cx, proxy);
   if (!expando) {
     return false;
   }
 
   bool dummy;
-  return js_DefineOwnProperty(cx, expando, id, desc, &dummy);
+  return js::DefineOwnProperty(cx, expando, id, desc, &dummy);
 }
 
 bool
 DOMProxyHandler::set(JSContext *cx, Handle<JSObject*> proxy, Handle<JSObject*> receiver,
                      Handle<jsid> id, bool strict, MutableHandle<JS::Value> vp) const
 {
   MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
              "Should not have a XrayWrapper here");
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -218,17 +218,17 @@ StructuredCloneWriteCallback(JSContext* 
   MOZ_ASSERT(aWriter);
   MOZ_ASSERT(aClosure);
 
   auto* cloneWriteInfo =
     static_cast<IDBObjectStore::StructuredCloneWriteInfo*>(aClosure);
 
   if (JS_GetClass(aObj) == IDBObjectStore::DummyPropClass()) {
     MOZ_ASSERT(!cloneWriteInfo->mOffsetToKeyProp);
-    cloneWriteInfo->mOffsetToKeyProp = js_GetSCOffset(aWriter);
+    cloneWriteInfo->mOffsetToKeyProp = js::GetSCOffset(aWriter);
 
     uint64_t value = 0;
     // Omit endian swap
     return JS_WriteBytes(aWriter, &value, sizeof(value));
   }
 
   IDBMutableFile* mutableFile;
   if (NS_SUCCEEDED(UNWRAP_OBJECT(IDBMutableFile, aObj, mutableFile))) {
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1719,17 +1719,17 @@ NPObjWrapper_Convert(JSContext *cx, JS::
     return false;
   if (!v.isPrimitive() && JS::IsCallable(v.toObjectOrNull())) {
     if (!JS_CallFunctionValue(cx, obj, v, JS::HandleValueArray::empty(), vp))
       return false;
     if (vp.isPrimitive())
       return true;
   }
 
-  JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
+  JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                        JS_GetClass(obj)->name,
                        hint == JSTYPE_VOID
                        ? "primitive type"
                        : hint == JSTYPE_NUMBER
                        ? "number"
                        : "string");
   return false;
 }
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -795,17 +795,17 @@ JSObject *GetOrCreateObjectProperty(JSCo
   if (!JS_GetProperty(cx, aObject, aProperty, &val)) {
     return nullptr;
   }
   if (!val.isUndefined()) {
     if (val.isObject()) {
       return &val.toObject();
     }
 
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
       JSMSG_UNEXPECTED_TYPE, aProperty, "not an object");
     return nullptr;
   }
   return JS_DefineObject(cx, aObject, aProperty, nullptr, JSPROP_ENUMERATE);
 }
 
 /**
  * Set a property of an object from a nsString.
@@ -834,17 +834,17 @@ bool DefineOSFileConstants(JSContext *cx
 {
   MOZ_ASSERT(gInitialized);
 
   if (gPaths == nullptr) {
     // If an initialization error was ignored, we may end up with
     // |gInitialized == true| but |gPaths == nullptr|. We cannot
     // |MOZ_ASSERT| this, as this would kill precompile_cache.js,
     // so we simply return an error.
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr,
       JSMSG_CANT_OPEN, "OSFileConstants", "initialization has failed");
     return false;
   }
 
   JS::Rooted<JSObject*> objOS(cx);
   if (!(objOS = GetOrCreateObjectProperty(cx, global, "OS"))) {
     return false;
   }
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -452,17 +452,17 @@ ServiceWorkerGlobalScope::Clients()
   }
 
   return mClients;
 }
 
 bool
 GetterOnlyJSNative(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
 {
-  JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
+  JS_ReportErrorNumber(aCx, js::GetErrorMessage, nullptr, JSMSG_GETTER_ONLY);
   return false;
 }
 
 namespace {
 
 class WorkerScopeUnregisterRunnable;
 class UnregisterResultRunnable MOZ_FINAL : public WorkerRunnable
 {
--- a/js/ipc/JavaScriptLogging.h
+++ b/js/ipc/JavaScriptLogging.h
@@ -101,17 +101,17 @@ class Logging
         const char *side, *objDesc;
         void *ptr;
 
         if (local == incoming) {
             JS::RootedObject obj(cx);
             obj = shared->objects_.find(id);
             if (obj) {
                 JSAutoCompartment ac(cx, obj);
-                objDesc = js_ObjectClassName(cx, obj);
+                objDesc = js::ObjectClassName(cx, obj);
             } else {
                 objDesc = "<dead object>";
             }
 
             side = shared->isParent() ? "parent" : "child";
             ptr = js::UncheckedUnwrap(obj, true);
         } else {
             objDesc = "<cpow>";
--- a/js/ipc/WrapperAnswer.cpp
+++ b/js/ipc/WrapperAnswer.cpp
@@ -175,17 +175,17 @@ WrapperAnswer::RecvDefineProperty(const 
     if (!fromJSIDVariant(cx, idVar, &id))
         return fail(cx, rs);
 
     Rooted<JSPropertyDescriptor> desc(cx);
     if (!toDescriptor(cx, descriptor, &desc))
         return fail(cx, rs);
 
     bool ignored;
-    if (!js_DefineOwnProperty(cx, obj, id, desc, &ignored))
+    if (!js::DefineOwnProperty(cx, obj, id, desc, &ignored))
         return fail(cx, rs);
 
     return ok(rs);
 }
 
 bool
 WrapperAnswer::RecvDelete(const ObjectId &objId, const JSIDVariant &idVar, ReturnStatus *rs,
                           bool *success)
@@ -508,17 +508,17 @@ WrapperAnswer::RecvObjectClassIs(const O
     if (!obj) {
         // This is very unfortunate, but we have no choice.
         *result = false;
         return true;
     }
 
     LOG("%s.objectClassIs()", ReceiverObj(objId));
 
-    *result = js_ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
+    *result = js::ObjectClassIs(cx, obj, (js::ESClassValue)classValue);
     return true;
 }
 
 bool
 WrapperAnswer::RecvClassName(const ObjectId &objId, nsString *name)
 {
     AutoJSAPI jsapi;
     if (NS_WARN_IF(!jsapi.Init(scopeForTargetObjects())))
@@ -528,17 +528,17 @@ WrapperAnswer::RecvClassName(const Objec
     RootedObject obj(cx, findObjectById(cx, objId));
     if (!obj) {
         // This is very unfortunate, but we have no choice.
         return "<dead CPOW>";
     }
 
     LOG("%s.className()", ReceiverObj(objId));
 
-    *name = NS_ConvertASCIItoUTF16(js_ObjectClassName(cx, obj));
+    *name = NS_ConvertASCIItoUTF16(js::ObjectClassName(cx, obj));
     return true;
 }
 
 bool
 WrapperAnswer::RecvGetPrototypeOf(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *result)
 {
     *result = NullVariant();
 
--- a/js/public/Proxy.h
+++ b/js/public/Proxy.h
@@ -669,14 +669,14 @@ extern JS_FRIEND_API(void)
 assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id,
                     BaseProxyHandler::Action act);
 #else
 inline void assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id,
                                 BaseProxyHandler::Action act)
 {}
 #endif
 
+extern JS_FRIEND_API(JSObject *)
+InitProxyClass(JSContext *cx, JS::HandleObject obj);
+
 } /* namespace js */
 
-extern JS_FRIEND_API(JSObject *)
-js_InitProxyClass(JSContext *cx, JS::HandleObject obj);
-
 #endif /* js_Proxy_h */
--- a/js/src/asmjs/AsmJSLink.cpp
+++ b/js/src/asmjs/AsmJSLink.cpp
@@ -68,17 +68,17 @@ CloneModule(JSContext *cx, MutableHandle
 
     moduleObj.set(newModuleObj);
     return true;
 }
 
 static bool
 LinkFail(JSContext *cx, const char *str)
 {
-    JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage,
+    JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, GetErrorMessage,
                                  nullptr, JSMSG_USE_ASM_LINK_FAIL, str);
     return false;
 }
 
 static bool
 GetDataProperty(JSContext *cx, HandleValue objVal, HandlePropertyName field, MutableHandleValue v)
 {
     if (!objVal.isObject())
@@ -247,17 +247,17 @@ ValidateByteLength(JSContext *cx, Handle
         return false;
 
     if (!v.isObject() || !v.toObject().isBoundFunction())
         return LinkFail(cx, "byteLength must be a bound function object");
 
     RootedFunction fun(cx, &v.toObject().as<JSFunction>());
 
     RootedValue boundTarget(cx, ObjectValue(*fun->getBoundFunctionTarget()));
-    if (!IsNativeFunction(boundTarget, js_fun_call))
+    if (!IsNativeFunction(boundTarget, fun_call))
         return LinkFail(cx, "bound target of byteLength must be Function.prototype.call");
 
     RootedValue boundThis(cx, fun->getBoundFunctionThis());
     if (!IsNativeFunction(boundThis, ArrayBufferObject::byteLengthGetter))
         return LinkFail(cx, "bound this value must be ArrayBuffer.protototype.byteLength accessor");
 
     return true;
 }
@@ -731,17 +731,17 @@ CallAsmJS(JSContext *cx, unsigned argc, 
 
     // The correct way to handle this situation would be to allocate a new range
     // of PROT_NONE memory and module.changeHeap to this memory. That would
     // cause every access to take the out-of-bounds signal-handler path which
     // does the right thing. For now, just throw an out-of-memory exception
     // since these can technically pop out anywhere and the full fix may
     // actually OOM when trying to allocate the PROT_NONE memory.
     if (module.hasDetachedHeap()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
         return false;
     }
 
     {
         // Push an AsmJSActivation to describe the asm.js frames we're about to
         // push when running this module. Additionally, push a JitActivation so
         // that the optimized asm.js-to-Ion FFI call path (which we want to be
         // very fast) can avoid doing so. The JitActivation is marked as
@@ -1230,17 +1230,17 @@ js::AsmJSModuleToString(JSContext *cx, H
 
 bool
 js::IsAsmJSModuleLoadedFromCache(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     JSFunction *fun;
     if (!args.hasDefined(0) || !IsMaybeWrappedNativeFunction(args[0], LinkAsmJS, &fun)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_USE_ASM_TYPE_FAIL,
                              "argument passed to isAsmJSModuleLoadedFromCache is not a "
                              "validated asm.js module");
         return false;
     }
 
     bool loadedFromCache = ModuleFunctionToModuleObject(fun).module().loadedFromCache();
 
     args.rval().set(BooleanValue(loadedFromCache));
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -60,17 +60,17 @@ AllocateExecutableMemory(ExclusiveContex
 {
 #ifdef XP_WIN
     unsigned permissions = PAGE_EXECUTE_READWRITE;
 #else
     unsigned permissions = PROT_READ | PROT_WRITE | PROT_EXEC;
 #endif
     void *p = AllocateExecutableMemory(nullptr, bytes, permissions, "asm-js-code", AsmJSPageSize);
     if (!p)
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
     return (uint8_t *)p;
 }
 
 AsmJSModule::AsmJSModule(ScriptSource *scriptSource, uint32_t srcStart, uint32_t srcBodyStart,
                          bool strict, bool canUseSignalHandlers)
   : srcStart_(srcStart),
     srcBodyStart_(srcBodyStart),
     scriptSource_(scriptSource),
@@ -450,32 +450,32 @@ AsmJSModule::setAutoFlushICacheRange()
     MOZ_ASSERT(isFinished());
     AutoFlushICache::setRange(uintptr_t(code_), pod.codeBytes_);
 }
 
 static void
 AsmJSReportOverRecursed()
 {
     JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
-    js_ReportOverRecursed(cx);
+    ReportOverRecursed(cx);
 }
 
 static void
 OnDetached()
 {
     // See hasDetachedHeap comment in LinkAsmJS.
     JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_OUT_OF_MEMORY);
 }
 
 static void
 OnOutOfBounds()
 {
     JSContext *cx = JSRuntime::innermostAsmJSActivation()->cx();
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
 }
 
 static bool
 AsmJSHandleExecutionInterrupt()
 {
     AsmJSActivation *act = JSRuntime::innermostAsmJSActivation();
     act->module().setInterrupted(true);
     bool ret = CheckForInterrupt(act->cx());
--- a/js/src/asmjs/AsmJSValidate.cpp
+++ b/js/src/asmjs/AsmJSValidate.cpp
@@ -1476,17 +1476,17 @@ class MOZ_STACK_CLASS ModuleCompiler
     ~ModuleCompiler() {
         if (errorString_) {
             MOZ_ASSERT(errorOffset_ != UINT32_MAX);
             tokenStream().reportAsmJSError(errorOffset_,
                                            JSMSG_USE_ASM_TYPE_FAIL,
                                            errorString_.get());
         }
         if (errorOverRecursed_)
-            js_ReportOverRecursed(cx_);
+            ReportOverRecursed(cx_);
     }
 
     bool init() {
         if (!globals_.init() || !exits_.init())
             return false;
 
         if (!standardLibraryMathNames_.init() ||
             !addStandardLibraryMathName("sin", AsmJSMathBuiltin_sin) ||
--- a/js/src/builtin/AtomicsObject.cpp
+++ b/js/src/builtin/AtomicsObject.cpp
@@ -149,17 +149,17 @@ MSC_FETCHBITOP(uint32_t, long, _Interloc
 const Class AtomicsObject::class_ = {
     "Atomics",
     JSCLASS_HAS_CACHED_PROTO(JSProto_Atomics)
 };
 
 static bool
 ReportBadArrayType(JSContext *cx)
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_BAD_ARRAY);
     return false;
 }
 
 static bool
 GetSharedTypedArray(JSContext *cx, HandleValue v,
                     MutableHandle<SharedTypedArrayObject *> viewp)
 {
     if (!v.isObject())
@@ -1075,26 +1075,26 @@ js::FutexRuntime::wait(JSContext *cx, do
     MOZ_ASSERT(&cx->runtime()->fx == this);
     MOZ_ASSERT(lockHolder_ == PR_GetCurrentThread());
     MOZ_ASSERT(state_ == Idle || state_ == WaitingInterrupted);
 
     // Disallow waiting when a runtime is processing an interrupt.
     // See explanation below.
 
     if (state_ == WaitingInterrupted) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_WAIT_NOT_ALLOWED);
         return false;
     }
 
     const bool timed = !mozilla::IsInfinite(timeout_ms);
 
     // Reject the timeout if it is not exactly representable.  2e50 ms = 2e53 us = 6e39 years.
 
     if (timed && timeout_ms > 2e50) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ATOMICS_TOO_LONG);
         return false;
     }
 
     // Times and intervals are in microseconds.
 
     const uint64_t finalEnd = timed ? PRMJ_Now() + (uint64_t)ceil(timeout_ms * 1000.0) : 0;
 
     // 4000s is about the longest timeout slice that is guaranteed to
@@ -1257,17 +1257,17 @@ AtomicsObject::initClass(JSContext *cx, 
     if (!DefineProperty(cx, global, cx->names().Atomics, AtomicsValue, nullptr, nullptr, 0))
         return nullptr;
 
     global->setConstructor(JSProto_Atomics, AtomicsValue);
     return Atomics;
 }
 
 JSObject *
-js_InitAtomicsClass(JSContext *cx, HandleObject obj)
+js::InitAtomicsClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->is<GlobalObject>());
     Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
     return AtomicsObject::initClass(cx, global);
 }
 
 #undef CXX11_ATOMICS
 #undef GNU_ATOMICS
--- a/js/src/builtin/AtomicsObject.h
+++ b/js/src/builtin/AtomicsObject.h
@@ -118,14 +118,14 @@ public:
     static mozilla::Atomic<PRLock*> lock_;
 
 #ifdef DEBUG
     // Null or the thread holding the lock.
     static mozilla::Atomic<PRThread*> lockHolder_;
 #endif
 };
 
+JSObject *
+InitAtomicsClass(JSContext *cx, HandleObject obj);
+
 }  /* namespace js */
 
-JSObject *
-js_InitAtomicsClass(JSContext *cx, js::HandleObject obj);
-
 #endif /* builtin_AtomicsObject_h */
--- a/js/src/builtin/Eval.cpp
+++ b/js/src/builtin/Eval.cpp
@@ -229,17 +229,17 @@ EvalKernel(JSContext *cx, const CallArgs
 {
     MOZ_ASSERT((evalType == INDIRECT_EVAL) == !caller);
     MOZ_ASSERT((evalType == INDIRECT_EVAL) == !pc);
     MOZ_ASSERT_IF(evalType == INDIRECT_EVAL, scopeobj->is<GlobalObject>());
     AssertInnerizedScopeChain(cx, *scopeobj);
 
     Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
     if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
         return false;
     }
 
     // ES5 15.1.2.1 step 1.
     if (args.length() < 1) {
         args.rval().setUndefined();
         return true;
     }
@@ -353,17 +353,17 @@ js::DirectEvalStringFromIon(JSContext *c
                             HandleObject scopeobj, HandleScript callerScript,
                             HandleValue thisValue, HandleString str,
                             jsbytecode *pc, MutableHandleValue vp)
 {
     AssertInnerizedScopeChain(cx, *scopeobj);
 
     Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global());
     if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL);
         return false;
     }
 
     // ES5 15.1.2.1 steps 2-8.
 
     unsigned staticLevel = callerScript->staticLevel() + 1;
 
     RootedLinearString linearStr(cx, str->ensureLinear(cx));
--- a/js/src/builtin/Intl.cpp
+++ b/js/src/builtin/Intl.cpp
@@ -764,36 +764,36 @@ js::intl_availableCollations(JSContext *
     MOZ_ASSERT(args[0].isString());
 
     JSAutoByteString locale(cx, args[0].toString());
     if (!locale)
         return false;
     UErrorCode status = U_ZERO_ERROR;
     UEnumeration *values = ucol_getKeywordValuesForLocale("co", locale.ptr(), false, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     ScopedICUObject<UEnumeration> toClose(values, uenum_close);
 
     uint32_t count = uenum_count(values, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
 
     RootedObject collations(cx, NewDenseEmptyArray(cx));
     if (!collations)
         return false;
 
     uint32_t index = 0;
     for (uint32_t i = 0; i < count; i++) {
         const char *collation = uenum_next(values, nullptr, &status);
         if (U_FAILURE(status)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
             return false;
         }
 
         // Per ECMA-402, 10.2.3, we don't include standard and search:
         // "The values 'standard' and 'search' must not be used as elements in
         // any [[sortLocaleData]][locale].co and [[searchLocaleData]][locale].co
         // array."
         if (equal(collation, "standard") || equal(collation, "search"))
@@ -933,29 +933,29 @@ NewUCollator(JSContext *cx, HandleObject
             uCaseFirst = UCOL_LOWER_FIRST;
         else
             MOZ_ASSERT(equal(caseFirst, "false"));
     }
 
     UErrorCode status = U_ZERO_ERROR;
     UCollator *coll = ucol_open(icuLocale(locale.ptr()), &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return nullptr;
     }
 
     ucol_setAttribute(coll, UCOL_STRENGTH, uStrength, &status);
     ucol_setAttribute(coll, UCOL_CASE_LEVEL, uCaseLevel, &status);
     ucol_setAttribute(coll, UCOL_ALTERNATE_HANDLING, uAlternate, &status);
     ucol_setAttribute(coll, UCOL_NUMERIC_COLLATION, uNumeric, &status);
     ucol_setAttribute(coll, UCOL_NORMALIZATION_MODE, uNormalization, &status);
     ucol_setAttribute(coll, UCOL_CASE_FIRST, uCaseFirst, &status);
     if (U_FAILURE(status)) {
         ucol_close(coll);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return nullptr;
     }
 
     return coll;
 }
 
 static bool
 intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleString str2, MutableHandleValue result)
@@ -1261,17 +1261,17 @@ js::intl_numberingSystem(JSContext *cx, 
         return false;
 
     // There's no C API for numbering system, so use the C++ API and hope it
     // won't break. http://bugs.icu-project.org/trac/ticket/10039
     Locale ulocale(locale.ptr());
     UErrorCode status = U_ZERO_ERROR;
     NumberingSystem *numbers = NumberingSystem::createInstance(ulocale, status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     const char *name = numbers->getName();
     RootedString jsname(cx, JS_NewStringCopyZ(cx, name));
     delete numbers;
     if (!jsname)
         return false;
     args.rval().setString(jsname);
@@ -1392,25 +1392,25 @@ NewUNumberFormat(JSContext *cx, HandleOb
 
     if (!GetProperty(cx, internals, internals, cx->names().useGrouping, &value))
         return nullptr;
     uUseGrouping = value.toBoolean();
 
     UErrorCode status = U_ZERO_ERROR;
     UNumberFormat *nf = unum_open(uStyle, nullptr, 0, icuLocale(locale.ptr()), nullptr, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return nullptr;
     }
     ScopedICUObject<UNumberFormat> toClose(nf, unum_close);
 
     if (uCurrency) {
         unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, uCurrency, 3, &status);
         if (U_FAILURE(status)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
             return nullptr;
         }
     }
     if (uMinimumSignificantDigits != -1) {
         unum_setAttribute(nf, UNUM_SIGNIFICANT_DIGITS_USED, true);
         unum_setAttribute(nf, UNUM_MIN_SIGNIFICANT_DIGITS, uMinimumSignificantDigits);
         unum_setAttribute(nf, UNUM_MAX_SIGNIFICANT_DIGITS, uMaximumSignificantDigits);
     } else {
@@ -1439,17 +1439,17 @@ intl_FormatNumber(JSContext *cx, UNumber
                                  nullptr, &status);
     if (status == U_BUFFER_OVERFLOW_ERROR) {
         if (!chars.resize(size))
             return false;
         status = U_ZERO_ERROR;
         unum_formatDouble(nf, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
     }
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
 
     JSString *str = NewStringCopyN<CanGC>(cx, chars.begin(), size);
     if (!str)
         return false;
 
     result.setString(str);
@@ -1738,45 +1738,45 @@ js::intl_availableCalendars(JSContext *c
         return false;
     uint32_t index = 0;
 
     // We need the default calendar for the locale as the first result.
     UErrorCode status = U_ZERO_ERROR;
     UCalendar *cal = ucal_open(nullptr, 0, locale.ptr(), UCAL_DEFAULT, &status);
     const char *calendar = ucal_getType(cal, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     ucal_close(cal);
     RootedString jscalendar(cx, JS_NewStringCopyZ(cx, bcp47CalendarName(calendar)));
     if (!jscalendar)
         return false;
     RootedValue element(cx, StringValue(jscalendar));
     if (!DefineElement(cx, calendars, index++, element))
         return false;
 
     // Now get the calendars that "would make a difference", i.e., not the default.
     UEnumeration *values = ucal_getKeywordValuesForLocale("ca", locale.ptr(), false, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     ScopedICUObject<UEnumeration> toClose(values, uenum_close);
 
     uint32_t count = uenum_count(values, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
 
     for (; count > 0; count--) {
         calendar = uenum_next(values, nullptr, &status);
         if (U_FAILURE(status)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
             return false;
         }
 
         jscalendar = JS_NewStringCopyZ(cx, bcp47CalendarName(calendar));
         if (!jscalendar)
             return false;
         element = StringValue(jscalendar);
         if (!DefineElement(cx, calendars, index++, element))
@@ -1808,36 +1808,36 @@ js::intl_patternForSkeleton(JSContext *c
         return false;
 
     mozilla::Range<const char16_t> skeletonChars = stableChars.twoByteRange();
     uint32_t skeletonLen = u_strlen(Char16ToUChar(skeletonChars.start().get()));
 
     UErrorCode status = U_ZERO_ERROR;
     UDateTimePatternGenerator *gen = udatpg_open(icuLocale(locale.ptr()), &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     ScopedICUObject<UDateTimePatternGenerator> toClose(gen, udatpg_close);
 
     int32_t size = udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
                                          skeletonLen, nullptr, 0, &status);
     if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
     ScopedJSFreePtr<UChar> pattern(cx->pod_malloc<UChar>(size + 1));
     if (!pattern)
         return false;
     pattern[size] = '\0';
     status = U_ZERO_ERROR;
     udatpg_getBestPattern(gen, Char16ToUChar(skeletonChars.start().get()),
                           skeletonLen, pattern, size, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
 
     RootedString str(cx, JS_NewUCStringCopyZ(cx, reinterpret_cast<char16_t*>(pattern.get())));
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
@@ -1907,17 +1907,17 @@ NewUDateFormat(JSContext *cx, HandleObje
     UErrorCode status = U_ZERO_ERROR;
 
     // If building with ICU headers before 50.1, use UDAT_IGNORE instead of
     // UDAT_PATTERN.
     UDateFormat *df =
         udat_open(UDAT_PATTERN, UDAT_PATTERN, icuLocale(locale.ptr()), uTimeZone, uTimeZoneLength,
                   uPattern, uPatternLength, &status);
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return nullptr;
     }
 
     // ECMAScript requires the Gregorian calendar to be used from the beginning
     // of ECMAScript time.
     UCalendar *cal = const_cast<UCalendar*>(udat_getCalendar(df));
     ucal_setGregorianChange(cal, StartOfTime, &status);
 
@@ -1925,34 +1925,34 @@ NewUDateFormat(JSContext *cx, HandleObje
 
     return df;
 }
 
 static bool
 intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue result)
 {
     if (!IsFinite(x)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE);
         return false;
     }
 
     Vector<char16_t, INITIAL_CHAR_BUFFER_SIZE> chars(cx);
     if (!chars.resize(INITIAL_CHAR_BUFFER_SIZE))
         return false;
     UErrorCode status = U_ZERO_ERROR;
     int size = udat_format(df, x, Char16ToUChar(chars.begin()), INITIAL_CHAR_BUFFER_SIZE,
                            nullptr, &status);
     if (status == U_BUFFER_OVERFLOW_ERROR) {
         if (!chars.resize(size))
             return false;
         status = U_ZERO_ERROR;
         udat_format(df, x, Char16ToUChar(chars.begin()), size, nullptr, &status);
     }
     if (U_FAILURE(status)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
         return false;
     }
 
     JSString *str = NewStringCopyN<CanGC>(cx, chars.begin(), size);
     if (!str)
         return false;
 
     result.setString(str);
@@ -2027,17 +2027,17 @@ static const JSFunctionSpec intl_static_
     JS_FS_END
 };
 
 /**
  * Initializes the Intl Object and its standard built-in properties.
  * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
  */
 JSObject *
-js_InitIntlClass(JSContext *cx, HandleObject obj)
+js::InitIntlClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->is<GlobalObject>());
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     // The constructors above need to be able to determine whether they've been
     // called with this being "the standard built-in Intl object". The global
     // object reserves slots to track standard built-in objects, but doesn't
     // normally keep references to non-constructors. This makes sure there is one.
--- a/js/src/builtin/Intl.h
+++ b/js/src/builtin/Intl.h
@@ -10,24 +10,24 @@
 #include "NamespaceImports.h"
 #include "unicode/utypes.h"
 
 /*
  * The Intl module specified by standard ECMA-402,
  * ECMAScript Internationalization API Specification.
  */
 
+namespace js {
+
 /**
  * Initializes the Intl Object and its standard built-in properties.
  * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
  */
 extern JSObject *
-js_InitIntlClass(JSContext *cx, js::HandleObject obj);
-
-namespace js {
+InitIntlClass(JSContext *cx, HandleObject obj);
 
 /*
  * The following functions are for use by self-hosted code.
  */
 
 
 /******************** Collator ********************/
 
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -1184,34 +1184,34 @@ MapObject::set(JSContext *cx, HandleObje
         return false;
 
     AutoHashableValueRooter key(cx);
     if (!key.setValue(cx, k))
         return false;
 
     RelocatableValue rval(v);
     if (!map->put(key, rval)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     WriteBarrierPost(cx->runtime(), map, key.get());
     return true;
 }
 
 MapObject*
 MapObject::create(JSContext *cx)
 {
     Rooted<MapObject *> obj(cx, NewBuiltinClassInstance<MapObject>(cx));
     if (!obj)
         return nullptr;
 
     ValueMap *map = cx->new_<ValueMap>(cx->runtime());
     if (!map || !map->init()) {
         js_delete(map);
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     obj->setPrivate(map);
     return obj;
 }
 
 void
@@ -1256,17 +1256,17 @@ MapObject::construct(JSContext *cx, unsi
         ValueMap *map = obj->getData();
         while (true) {
             bool done;
             if (!iter.next(&pairVal, &done))
                 return false;
             if (done)
                 break;
             if (!pairVal.isObject()) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+                JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                      JSMSG_INVALID_MAP_ITERABLE, "Map");
                 return false;
             }
 
             pairObj = &pairVal.toObject();
             if (!pairObj)
                 return false;
 
@@ -1279,17 +1279,17 @@ MapObject::construct(JSContext *cx, unsi
                 return false;
 
             if (isOriginalAdder) {
                 if (!hkey.setValue(cx, key))
                     return false;
 
                 RelocatableValue rval(val);
                 if (!map->put(hkey, rval)) {
-                    js_ReportOutOfMemory(cx);
+                    ReportOutOfMemory(cx);
                     return false;
                 }
                 WriteBarrierPost(cx->runtime(), map, key);
             } else {
                 if (!args2.init(2))
                     return false;
 
                 args2.setCallee(adderVal);
@@ -1436,17 +1436,17 @@ bool
 MapObject::set_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(MapObject::is(args.thisv()));
 
     ValueMap &map = extract(args);
     ARG0_KEY(cx, args, key);
     RelocatableValue rval(args.get(1));
     if (!map.put(key, rval)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     WriteBarrierPost(cx->runtime(), &map, key.get());
     args.rval().set(args.thisv());
     return true;
 }
 
 bool
@@ -1469,17 +1469,17 @@ MapObject::delete_impl(JSContext *cx, Ca
     // of a ValueMap, Value() means RelocatableValue(), which is the same as
     // RelocatableValue(UndefinedValue()).
     MOZ_ASSERT(MapObject::is(args.thisv()));
 
     ValueMap &map = extract(args);
     ARG0_KEY(cx, args, key);
     bool found;
     if (!map.remove(key, &found)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     args.rval().setBoolean(found);
     return true;
 }
 
 bool
 MapObject::delete_(JSContext *cx, unsigned argc, Value *vp)
@@ -1560,24 +1560,24 @@ MapObject::clear(JSContext *cx, unsigned
 }
 
 bool
 MapObject::clear(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(MapObject::is(obj));
     ValueMap &map = extract(obj);
     if (!map.clear()) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     return true;
 }
 
 JSObject *
-js_InitMapClass(JSContext *cx, HandleObject obj)
+js::InitMapClass(JSContext *cx, HandleObject obj)
 {
     return MapObject::initClass(cx, obj);
 }
 
 
 /*** SetIterator *********************************************************************************/
 
 namespace {
@@ -1823,34 +1823,34 @@ SetObject::add(JSContext *cx, HandleObje
     if (!set)
         return false;
 
     AutoHashableValueRooter key(cx);
     if (!key.setValue(cx, k))
         return false;
 
     if (!set->put(key)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     WriteBarrierPost(cx->runtime(), set, key.get());
     return true;
 }
 
 SetObject*
 SetObject::create(JSContext *cx)
 {
     SetObject *obj = NewBuiltinClassInstance<SetObject>(cx);
     if (!obj)
         return nullptr;
 
     ValueSet *set = cx->new_<ValueSet>(cx->runtime());
     if (!set || !set->init()) {
         js_delete(set);
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
     obj->setPrivate(set);
     return obj;
 }
 
 void
 SetObject::mark(JSTracer *trc, JSObject *obj)
@@ -1908,17 +1908,17 @@ SetObject::construct(JSContext *cx, unsi
                 return false;
             if (done)
                 break;
 
             if (isOriginalAdder) {
                 if (!key.setValue(cx, keyVal))
                     return false;
                 if (!set->put(key)) {
-                    js_ReportOutOfMemory(cx);
+                    ReportOutOfMemory(cx);
                     return false;
                 }
                 WriteBarrierPost(cx->runtime(), set, keyVal);
             } else {
                 if (!args2.init(1))
                     return false;
 
                 args2.setCallee(adderVal);
@@ -1989,17 +1989,17 @@ SetObject::has(JSContext *cx, unsigned a
 bool
 SetObject::add_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     ValueSet &set = extract(args);
     ARG0_KEY(cx, args, key);
     if (!set.put(key)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     WriteBarrierPost(cx->runtime(), &set, key.get());
     args.rval().set(args.thisv());
     return true;
 }
 
 bool
@@ -2013,17 +2013,17 @@ bool
 SetObject::delete_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     ValueSet &set = extract(args);
     ARG0_KEY(cx, args, key);
     bool found;
     if (!set.remove(key, &found)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     args.rval().setBoolean(found);
     return true;
 }
 
 bool
 SetObject::delete_(JSContext *cx, unsigned argc, Value *vp)
@@ -2070,32 +2070,32 @@ SetObject::entries(JSContext *cx, unsign
     return CallNonGenericMethod(cx, is, entries_impl, args);
 }
 
 bool
 SetObject::clear_impl(JSContext *cx, CallArgs args)
 {
     Rooted<SetObject*> setobj(cx, &args.thisv().toObject().as<SetObject>());
     if (!setobj->getData()->clear()) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     args.rval().setUndefined();
     return true;
 }
 
 bool
 SetObject::clear(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod(cx, is, clear_impl, args);
 }
 
 JSObject *
-js_InitSetClass(JSContext *cx, HandleObject obj)
+js::InitSetClass(JSContext *cx, HandleObject obj)
 {
     return SetObject::initClass(cx, obj);
 }
 
 const JSFunctionSpec selfhosting_collection_iterator_methods[] = {
     JS_FN("std_Map_iterator_next", MapIteratorObject::next, 0, 0),
     JS_FN("std_Set_iterator_next", SetIteratorObject::next, 0, 0),
     JS_FS_END
--- a/js/src/builtin/MapObject.h
+++ b/js/src/builtin/MapObject.h
@@ -175,17 +175,17 @@ class SetObject : public NativeObject {
     static bool entries(JSContext *cx, unsigned argc, Value *vp);
     static bool clear_impl(JSContext *cx, CallArgs args);
     static bool clear(JSContext *cx, unsigned argc, Value *vp);
 };
 
 extern bool
 InitSelfHostingCollectionIteratorFunctions(JSContext *cx, js::HandleObject obj);
 
-} /* namespace js */
+extern JSObject *
+InitMapClass(JSContext *cx, HandleObject obj);
 
 extern JSObject *
-js_InitMapClass(JSContext *cx, js::HandleObject obj);
+InitSetClass(JSContext *cx, HandleObject obj);
 
-extern JSObject *
-js_InitSetClass(JSContext *cx, js::HandleObject obj);
+} /* namespace js */
 
 #endif /* builtin_MapObject_h */
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -230,17 +230,17 @@ js::ObjectToSource(JSContext *cx, Handle
             /*
              * If id is a string that's not an identifier, or if it's a negative
              * integer, then it must be quoted.
              */
             if (JSID_IS_ATOM(id)
                 ? !IsIdentifier(JSID_TO_ATOM(id))
                 : JSID_TO_INT(id) < 0)
             {
-                idstr = js_QuoteString(cx, idstr, char16_t('\''));
+                idstr = QuoteString(cx, idstr, char16_t('\''));
                 if (!idstr)
                     return nullptr;
             }
         }
 
         for (int j = 0; j < valcnt; j++) {
             /* Convert val[j] to its canonical source form. */
             JSString *valsource = ValueToSource(cx, val[j]);
@@ -414,31 +414,31 @@ obj_setPrototypeOf(JSContext *cx, unsign
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedObject setPrototypeOf(cx, &args.callee());
     if (!GlobalObject::warnOnceAboutPrototypeMutation(cx, setPrototypeOf))
         return false;
 
     if (args.length() < 2) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "Object.setPrototypeOf", "1", "");
         return false;
     }
 
     /* Step 1-2. */
     if (args[0].isNullOrUndefined()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                              args[0].isNull() ? "null" : "undefined", "object");
         return false;
     }
 
     /* Step 3. */
     if (!args[1].isObjectOrNull()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
                              "Object.setPrototypeOf", "an object or null", InformalValueTypeName(args[1]));
         return false;
     }
 
     /* Step 4. */
     if (!args[0].isObject()) {
         args.rval().set(args[0]);
         return true;
@@ -453,17 +453,17 @@ obj_setPrototypeOf(JSContext *cx, unsign
         return false;
 
     /* Step 7. */
     if (!success) {
         UniquePtr<char[], JS::FreePolicy> bytes(DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
                                                                         args[0], NullPtr()));
         if (!bytes)
             return false;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
                              bytes.get());
         return false;
     }
 
     /* Step 8. */
     args.rval().set(args[0]);
     return true;
 }
@@ -500,17 +500,17 @@ obj_watch(JSContext *cx, unsigned argc, 
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj)
         return false;
 
     if (!GlobalObject::warnOnceAboutWatch(cx, obj))
         return false;
 
     if (args.length() <= 1) {
-        js_ReportMissingArg(cx, args.calleev(), 1);
+        ReportMissingArg(cx, args.calleev(), 1);
         return false;
     }
 
     RootedObject callable(cx, ValueToCallable(cx, args[1], args.length() - 2));
     if (!callable)
         return false;
 
     RootedId propid(cx);
@@ -662,27 +662,27 @@ js::ObjectCreateWithTemplate(JSContext *
 // ES6 draft rev34 (2015/02/20) 19.1.2.2 Object.create(O [, Properties])
 bool
 js::obj_create(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     if (args.length() == 0) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "Object.create", "0", "s");
         return false;
     }
 
     if (!args[0].isObjectOrNull()) {
         RootedValue v(cx, args[0]);
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
         if (!bytes)
             return false;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
                              bytes, "not an object or null");
         js_free(bytes);
         return false;
     }
 
     // Step 2.
     RootedObject proto(cx, args[0].toObjectOrNull());
     RootedPlainObject obj(cx, ObjectCreateImpl(cx, proto));
@@ -850,17 +850,17 @@ obj_defineProperties(JSContext *cx, unsi
     /* Steps 1 and 7. */
     RootedObject obj(cx);
     if (!GetFirstArgumentAsObject(cx, args, "Object.defineProperties", &obj))
         return false;
     args.rval().setObject(*obj);
 
     /* Step 2. */
     if (args.length() < 2) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "Object.defineProperties", "0", "s");
         return false;
     }
     RootedValue val(cx, args[1]);
     RootedObject props(cx, ToObject(cx, val));
     if (!props)
         return false;
 
@@ -902,17 +902,17 @@ obj_preventExtensions(JSContext *cx, uns
     RootedObject obj(cx, &args.get(0).toObject());
 
     bool status;
     if (!PreventExtensions(cx, obj, &status))
         return false;
 
     // Step 4.
     if (!status) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
         return false;
     }
 
     // Step 5.
     return true;
 }
 
 // ES6 draft rev27 (2014/08/24) 19.1.2.5 Object.freeze(O)
@@ -1045,17 +1045,17 @@ ProtoSetter(JSContext *cx, unsigned argc
 
     Rooted<JSObject*> newProto(cx, args[0].toObjectOrNull());
 
     bool success;
     if (!SetPrototype(cx, obj, newProto, &success))
         return false;
 
     if (!success) {
-        js_ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, thisv, js::NullPtr());
+        ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, thisv, js::NullPtr());
         return false;
     }
 
     args.rval().setUndefined();
     return true;
 }
 
 static const JSFunctionSpec object_methods[] = {
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -177,17 +177,17 @@ CompileRegExpObject(JSContext *cx, RegEx
         /*
          * Beware, sourceObj may be a (transparent) proxy to a RegExp, so only
          * use generic (proxyable) operations on sourceObj that do not assume
          * sourceObj.is<RegExpObject>().
          */
         RootedObject sourceObj(cx, &sourceValue.toObject());
 
         if (args.hasDefined(1)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NEWREGEXP_FLAGGED);
             return false;
         }
 
         /*
          * Extract the 'source' and the 'flags' out of sourceObj; do not reuse
          * the RegExpShared since it may be from a different compartment.
          */
         RootedAtom sourceAtom(cx);
@@ -572,17 +572,17 @@ static const JSPropertySpec regexp_stati
     JS_PSG("$&", static_lastMatch_getter, JSPROP_PERMANENT),
     JS_PSG("$+", static_lastParen_getter, JSPROP_PERMANENT),
     JS_PSG("$`", static_leftContext_getter, JSPROP_PERMANENT),
     JS_PSG("$'", static_rightContext_getter, JSPROP_PERMANENT),
     JS_PS_END
 };
 
 JSObject *
-js_InitRegExpClass(JSContext *cx, HandleObject obj)
+js::InitRegExpClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->isNative());
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     Rooted<RegExpObject*> proto(cx, global->createBlankPrototype<RegExpObject>(cx));
     if (!proto)
         return nullptr;
--- a/js/src/builtin/RegExp.h
+++ b/js/src/builtin/RegExp.h
@@ -4,29 +4,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef builtin_RegExp_h
 #define builtin_RegExp_h
 
 #include "vm/RegExpObject.h"
 
-JSObject *
-js_InitRegExpClass(JSContext *cx, js::HandleObject obj);
-
-bool
-regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
-
 /*
  * The following builtin natives are extern'd for pointer comparison in
  * other parts of the engine.
  */
 
 namespace js {
 
+bool
+regexp_flags(JSContext *cx, unsigned argc, JS::Value *vp);
+
+JSObject *
+InitRegExpClass(JSContext *cx, HandleObject obj);
+
 // Whether RegExp statics should be updated with the input and results of a
 // regular expression execution.
 enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics };
 
 // Whether RegExp statics should be used to create a RegExp instance.
 enum RegExpStaticsUse { UseRegExpStatics, DontUseRegExpStatics };
 
 RegExpRunStatus
--- a/js/src/builtin/SIMD.cpp
+++ b/js/src/builtin/SIMD.cpp
@@ -69,17 +69,17 @@ template bool js::IsVectorObject<Float32
 template bool js::IsVectorObject<Float64x2>(HandleValue v);
 
 template<typename V>
 bool
 js::ToSimdConstant(JSContext *cx, HandleValue v, jit::SimdConstant *out)
 {
     typedef typename V::Elem Elem;
     if (!IsVectorObject<V>(v)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
         return false;
     }
 
     Elem *mem = reinterpret_cast<Elem *>(v.toObject().as<TypedObject>().typedMem());
     *out = jit::SimdConstant::CreateX4(mem);
     return true;
 }
 
@@ -96,17 +96,17 @@ TypedObjectMemory(HandleValue v)
 
 template<typename SimdType, int lane>
 static bool GetSimdLane(JSContext *cx, unsigned argc, Value *vp)
 {
     typedef typename SimdType::Elem Elem;
 
     CallArgs args = CallArgsFromVp(argc, vp);
     if (!IsVectorObject<SimdType>(args.thisv())) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                              SimdTypeDescr::class_.name, laneNames[lane],
                              InformalValueTypeName(args.thisv()));
         return false;
     }
 
     Elem *data = TypedObjectMemory<Elem *>(args.thisv());
     SimdType::setReturn(args, data[lane]);
     return true;
@@ -133,26 +133,26 @@ static bool type##Lane##lane(JSContext *
 
 template<typename SimdType>
 static bool SignMask(JSContext *cx, unsigned argc, Value *vp)
 {
     typedef typename SimdType::Elem Elem;
 
     CallArgs args = CallArgsFromVp(argc, vp);
     if (!args.thisv().isObject() || !args.thisv().toObject().is<TypedObject>()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                              SimdTypeDescr::class_.name, "signMask",
                              InformalValueTypeName(args.thisv()));
         return false;
     }
 
     TypedObject &typedObj = args.thisv().toObject().as<TypedObject>();
     TypeDescr &descr = typedObj.typeDescr();
     if (descr.kind() != type::Simd || descr.as<SimdTypeDescr>().type() != SimdType::type) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                              SimdTypeDescr::class_.name, "signMask",
                              InformalValueTypeName(args.thisv()));
         return false;
     }
 
     // Load the data as integer so that we treat the sign bit consistently,
     // since -0.0 is not less than zero, but it still has the sign bit set.
     typedef typename mozilla::SignedStdintTypeForSize<sizeof(Elem)>::Type Int;
@@ -481,17 +481,17 @@ SIMDObject::initClass(JSContext *cx, Han
     global->setConstructor(JSProto_SIMD, SIMDValue);
     global->setFloat32x4TypeDescr(*float32x4Object);
     global->setFloat64x2TypeDescr(*float64x2Object);
     global->setInt32x4TypeDescr(*int32x4Object);
     return SIMD;
 }
 
 JSObject *
-js_InitSIMDClass(JSContext *cx, HandleObject obj)
+js::InitSIMDClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->is<GlobalObject>());
     Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
     return SIMDObject::initClass(cx, global);
 }
 
 template<typename V>
 JSObject *
@@ -639,17 +639,17 @@ struct ShiftRight {
 struct ShiftRightLogical {
     static inline int32_t apply(int32_t v, int32_t bits) { return uint32_t(v) >> (bits & 31); }
 };
 }
 
 static inline bool
 ErrorBadArgs(JSContext *cx)
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
     return false;
 }
 
 template<typename Out>
 static bool
 StoreResult(JSContext *cx, CallArgs &args, typename Out::Elem *result)
 {
     RootedObject obj(cx, CreateSimd<Out>(cx, result));
@@ -1032,17 +1032,17 @@ TypedArrayFromArgs(JSContext *cx, const 
     if (!ToInt32(cx, args[1], &index))
         return false;
 
     *byteStart = index * AnyTypedArrayBytesPerElement(typedArray);
     if (*byteStart < 0 ||
         (uint32_t(*byteStart) + NumElem * sizeof(VElem)) > AnyTypedArrayByteLength(typedArray))
     {
         // Keep in sync with AsmJS OnOutOfBounds function.
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
         return false;
     }
 
     return true;
 }
 
 template<class V, unsigned NumElem>
 static bool
--- a/js/src/builtin/SIMD.h
+++ b/js/src/builtin/SIMD.h
@@ -344,14 +344,14 @@ FLOAT64X2_FUNCTION_LIST(DECLARE_SIMD_FLO
 #undef DECLARE_SIMD_FLOAT64X2_FUNCTION
 
 #define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags)   \
 extern bool                                                          \
 simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp);
 INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION)
 #undef DECLARE_SIMD_INT32x4_FUNCTION
 
+JSObject *
+InitSIMDClass(JSContext *cx, HandleObject obj);
+
 }  /* namespace js */
 
-JSObject *
-js_InitSIMDClass(JSContext *cx, js::HandleObject obj);
-
 #endif /* builtin_SIMD_h */
--- a/js/src/builtin/SymbolObject.cpp
+++ b/js/src/builtin/SymbolObject.cpp
@@ -98,17 +98,17 @@ bool
 SymbolObject::construct(JSContext *cx, unsigned argc, Value *vp)
 {
     // According to a note in the draft standard, "Symbol has ordinary
     // [[Construct]] behaviour but the definition of its @@create method causes
     // `new Symbol` to throw a TypeError exception." We do not support @@create
     // yet, so just throw a TypeError.
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.isConstructing()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_CONSTRUCTOR, "Symbol");
         return false;
     }
 
     // steps 1-3
     RootedString desc(cx);
     if (!args.get(0).isUndefined()) {
         desc = ToString(cx, args.get(0));
         if (!desc)
@@ -154,18 +154,18 @@ SymbolObject::for_(JSContext *cx, unsign
 bool
 SymbolObject::keyFor(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // step 1
     HandleValue arg = args.get(0);
     if (!arg.isSymbol()) {
-        js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
-                                 arg, js::NullPtr(), "not a symbol", nullptr);
+        ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
+                              arg, js::NullPtr(), "not a symbol", nullptr);
         return false;
     }
 
     // step 2
     if (arg.toSymbol()->code() == JS::SymbolCode::InSymbolRegistry) {
 #ifdef DEBUG
         RootedString desc(cx, arg.toSymbol()->description());
         MOZ_ASSERT(Symbol::for_(cx, desc) == arg.toSymbol());
@@ -225,12 +225,12 @@ SymbolObject::valueOf_impl(JSContext *cx
 bool
 SymbolObject::valueOf(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsSymbol, valueOf_impl>(cx, args);
 }
 
 JSObject *
-js_InitSymbolClass(JSContext *cx, HandleObject obj)
+js::InitSymbolClass(JSContext *cx, HandleObject obj)
 {
     return SymbolObject::initClass(cx, obj);
 }
--- a/js/src/builtin/SymbolObject.h
+++ b/js/src/builtin/SymbolObject.h
@@ -53,14 +53,14 @@ class SymbolObject : public NativeObject
     static bool valueOf_impl(JSContext *cx, CallArgs args);
     static bool valueOf(JSContext *cx, unsigned argc, Value *vp);
 
     static const JSPropertySpec properties[];
     static const JSFunctionSpec methods[];
     static const JSFunctionSpec staticMethods[];
 };
 
+extern JSObject *
+InitSymbolClass(JSContext *cx, HandleObject obj);
+
 } /* namespace js */
 
-extern JSObject *
-js_InitSymbolClass(JSContext *cx, js::HandleObject obj);
-
 #endif /* builtin_SymbolObject_h */
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -742,27 +742,27 @@ NondeterministicGetWeakMapKeys(JSContext
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() != 1) {
         RootedObject callee(cx, &args.callee());
         ReportUsageError(cx, callee, "Wrong number of arguments");
         return false;
     }
     if (!args[0].isObject()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
                              "nondeterministicGetWeakMapKeys", "WeakMap",
                              InformalValueTypeName(args[0]));
         return false;
     }
     RootedObject arr(cx);
     RootedObject mapObj(cx, &args[0].toObject());
     if (!JS_NondeterministicGetWeakMapKeys(cx, mapObj, &arr))
         return false;
     if (!arr) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE,
                              "nondeterministicGetWeakMapKeys", "WeakMap",
                              args[0].toObject().getClass()->name);
         return false;
     }
     args.rval().setObject(*arr);
     return true;
 }
 
@@ -966,30 +966,30 @@ SaveStack(JSContext *cx, unsigned argc, 
     CallArgs args = CallArgsFromVp(argc, vp);
 
     unsigned maxFrameCount = 0;
     if (args.length() >= 1) {
         double d;
         if (!ToNumber(cx, args[0], &d))
             return false;
         if (d < 0) {
-            js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                     JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
-                                     "not a valid maximum frame count", NULL);
+            ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                                  JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                                  "not a valid maximum frame count", NULL);
             return false;
         }
         maxFrameCount = d;
     }
 
     JSCompartment *targetCompartment = cx->compartment();
     if (args.length() >= 2) {
         if (!args[1].isObject()) {
-            js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                     JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
-                                     "not an object", NULL);
+            ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                                  JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                                  "not an object", NULL);
             return false;
         }
         RootedObject obj(cx, UncheckedUnwrap(&args[1].toObject()));
         if (!obj)
             return false;
         targetCompartment = obj->compartment();
     }
 
@@ -2103,35 +2103,35 @@ struct FindPathHandler {
 
 } // namespace heaptools
 
 static bool
 FindPath(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (argc < 2) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
                              "findPath", "1", "");
         return false;
     }
 
     // We don't ToString non-objects given as 'start' or 'target', because this
     // test is all about object identity, and ToString doesn't preserve that.
     // Non-GCThing endpoints don't make much sense.
     if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
-        js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                 JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
-                                 "not an object, string, or symbol", NULL);
+        ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                              JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                              "not an object, string, or symbol", NULL);
         return false;
     }
 
     if (!args[1].isObject() && !args[1].isString() && !args[1].isSymbol()) {
-        js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                 JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
-                                 "not an object, string, or symbol", NULL);
+        ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                              JSDVG_SEARCH_STACK, args[0], JS::NullPtr(),
+                              "not an object, string, or symbol", NULL);
         return false;
     }
 
     AutoValueVector nodes(cx);
     Vector<heaptools::EdgeName> edges(cx);
 
     {
         // We can't tolerate the GC moving things around while we're searching
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -43,17 +43,17 @@ static const JSFunctionSpec TypedObjectM
     JS_SELF_HOSTED_FN("objectType", "TypeOfTypedObject", 1, 0),
     JS_SELF_HOSTED_FN("storage", "StorageOfTypedObject", 1, 0),
     JS_FS_END
 };
 
 static void
 ReportCannotConvertTo(JSContext *cx, HandleValue fromValue, const char *toType)
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                          InformalValueTypeName(fromValue), toType);
 }
 
 template<class T>
 static inline T*
 ToObjectIf(HandleValue value)
 {
     if (!value.isObject())
@@ -180,17 +180,17 @@ GetPrototype(JSContext *cx, HandleObject
 {
     RootedValue prototypeVal(cx);
     if (!GetProperty(cx, obj, obj, cx->names().prototype,
                                &prototypeVal))
     {
         return nullptr;
     }
     if (!prototypeVal.isObject()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_INVALID_PROTOTYPE);
         return nullptr;
     }
     return &prototypeVal.toObject();
 }
 
 /***************************************************************************
  * Typed Prototypes
@@ -263,17 +263,17 @@ ScalarTypeDescr::typeName(Type type)
     MOZ_CRASH("Invalid type");
 }
 
 bool
 ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              args.callee().getClass()->name, "0", "s");
         return false;
     }
 
     Rooted<ScalarTypeDescr *> descr(cx, &args.callee().as<ScalarTypeDescr>());
     ScalarTypeDescr::Type type = descr->type();
 
     double number;
@@ -367,17 +367,17 @@ bool
 js::ReferenceTypeDescr::call(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     MOZ_ASSERT(args.callee().is<ReferenceTypeDescr>());
     Rooted<ReferenceTypeDescr *> descr(cx, &args.callee().as<ReferenceTypeDescr>());
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_MORE_ARGS_NEEDED,
                              descr->typeName(), "0", "s");
         return false;
     }
 
     switch (descr->type()) {
       case ReferenceTypeDescr::TYPE_ANY:
         args.rval().set(args[0]);
@@ -639,26 +639,26 @@ ArrayMetaTypeDescr::create(JSContext *cx
 }
 
 bool
 ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (!args.isConstructing()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_NOT_FUNCTION, "ArrayType");
         return false;
     }
 
     RootedObject arrayTypeGlobal(cx, &args.callee());
 
     // Expect two arguments. The first is a type object, the second is a length.
     if (args.length() < 2) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "ArrayType", "1", "");
         return false;
     }
 
     if (!args[0].isObject() || !args[0].toObject().is<TypeDescr>()) {
         ReportCannotConvertTo(cx, args[0], "ArrayType element specifier");
         return false;
     }
@@ -670,17 +670,17 @@ ArrayMetaTypeDescr::construct(JSContext 
 
     Rooted<TypeDescr*> elementType(cx, &args[0].toObject().as<TypeDescr>());
 
     int32_t length = args[1].toInt32();
 
     // Compute the byte size.
     CheckedInt32 size = CheckedInt32(elementType->size()) * length;
     if (!size.isValid()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_TYPEDOBJECT_TOO_BIG);
         return false;
     }
 
     // Construct a canonical string `new ArrayType(<elementType>, N)`:
     StringBuffer contents(cx);
     contents.append("new ArrayType(");
     contents.append(&elementType->stringRepr());
@@ -782,17 +782,17 @@ StructMetaTypeDescr::create(JSContext *c
     if (!userFieldOffsets)
         return nullptr;
 
     userFieldTypes = NewObjectWithProto<PlainObject>(cx, NullPtr(), NullPtr(), TenuredObject);
     if (!userFieldTypes)
         return nullptr;
 
     if (!stringBuffer.append("new StructType({")) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     RootedValue fieldTypeVal(cx);
     RootedId id(cx);
     Rooted<TypeDescr*> fieldType(cx);
     for (unsigned int i = 0; i < ids.length(); i++) {
         id = ids[i];
@@ -813,100 +813,100 @@ StructMetaTypeDescr::create(JSContext *c
         if (!fieldType) {
             ReportCannotConvertTo(cx, fieldTypeVal, "StructType field specifier");
             return nullptr;
         }
 
         // Collect field name and type object
         RootedValue fieldName(cx, IdToValue(id));
         if (!fieldNames.append(fieldName)) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         if (!fieldTypeObjs.append(ObjectValue(*fieldType))) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
 
         // userFieldTypes[id] = typeObj
         if (!DefineProperty(cx, userFieldTypes, id, fieldTypeObjs[i], nullptr, nullptr,
                             JSPROP_READONLY | JSPROP_PERMANENT))
         {
             return nullptr;
         }
 
         // Append "f:Type" to the string repr
         if (i > 0 && !stringBuffer.append(", ")) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         if (!stringBuffer.append(JSID_TO_ATOM(id))) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         if (!stringBuffer.append(": ")) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         if (!stringBuffer.append(&fieldType->stringRepr())) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
 
         // Offset of this field is the current total size adjusted for
         // the field's alignment.
         CheckedInt32 offset = roundUpToAlignment(sizeSoFar, fieldType->alignment());
         if (!offset.isValid()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                  JSMSG_TYPEDOBJECT_TOO_BIG);
             return nullptr;
         }
         MOZ_ASSERT(offset.value() >= 0);
         if (!fieldOffsets.append(Int32Value(offset.value()))) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
 
         // userFieldOffsets[id] = offset
         RootedValue offsetValue(cx, Int32Value(offset.value()));
         if (!DefineProperty(cx, userFieldOffsets, id, offsetValue, nullptr, nullptr,
                             JSPROP_READONLY | JSPROP_PERMANENT))
         {
             return nullptr;
         }
 
         // Add space for this field to the total struct size.
         sizeSoFar = offset + fieldType->size();
         if (!sizeSoFar.isValid()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                  JSMSG_TYPEDOBJECT_TOO_BIG);
             return nullptr;
         }
 
         // Struct is opaque if any field is opaque
         if (fieldType->opaque())
             opaque = true;
 
         // Alignment of the struct is the max of the alignment of its fields.
         alignment = js::Max(alignment, fieldType->alignment());
     }
 
     // Complete string representation.
     if (!stringBuffer.append("})")) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
     RootedAtom stringRepr(cx, stringBuffer.finishAtom());
     if (!stringRepr)
         return nullptr;
 
     // Adjust the total size to be a multiple of the final alignment.
     CheckedInt32 totalSize = roundUpToAlignment(sizeSoFar, alignment);
     if (!totalSize.isValid()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_TYPEDOBJECT_TOO_BIG);
         return nullptr;
     }
 
     // Now create the resulting type descriptor.
     RootedObject structTypePrototype(cx, GetPrototype(cx, metaTypeDescr));
     if (!structTypePrototype)
         return nullptr;
@@ -997,32 +997,32 @@ StructMetaTypeDescr::create(JSContext *c
 }
 
 bool
 StructMetaTypeDescr::construct(JSContext *cx, unsigned int argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (!args.isConstructing()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_NOT_FUNCTION, "StructType");
         return false;
     }
 
     if (args.length() >= 1 && args[0].isObject()) {
         RootedObject metaTypeDescr(cx, &args.callee());
         RootedObject fields(cx, &args[0].toObject());
         RootedObject obj(cx, create(cx, metaTypeDescr, fields));
         if (!obj)
             return false;
         args.rval().setObject(*obj);
         return true;
     }
 
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                          JSMSG_TYPEDOBJECT_STRUCTTYPE_BAD_ARGS);
     return false;
 }
 
 size_t
 StructTypeDescr::fieldCount() const
 {
     return fieldInfoObject(JS_DESCR_SLOT_STRUCT_FIELD_NAMES).getDenseInitializedLength();
@@ -1328,35 +1328,23 @@ GlobalObject::initTypedObjectModule(JSCo
     global->setConstructor(JSProto_TypedObject, moduleValue);
     if (!DefineProperty(cx, global, cx->names().TypedObject, moduleValue, nullptr, nullptr, 0))
         return false;
 
     return module;
 }
 
 JSObject *
-js_InitTypedObjectModuleObject(JSContext *cx, HandleObject obj)
+js::InitTypedObjectModuleObject(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->is<GlobalObject>());
     Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
     return global->getOrCreateTypedObjectModule(cx);
 }
 
-JSObject *
-js_InitTypedObjectDummy(JSContext *cx, HandleObject obj)
-{
-    /*
-     * This function is entered into the jsprototypes.h table
-     * as the initializer for `TypedObject`. It should not
-     * be executed via the `standard_class_atoms` mechanism.
-     */
-
-    MOZ_CRASH("shouldn't be initializing TypedObject via the JSProtoKey initializer mechanism");
-}
-
 /******************************************************************************
  * Typed objects
  */
 
 int32_t
 TypedObject::offset() const
 {
     if (is<InlineTypedObject>())
@@ -1628,17 +1616,17 @@ ReportTypedObjTypeError(JSContext *cx,
                         const unsigned errorNumber,
                         HandleTypedObject obj)
 {
     // Serialize type string of obj
     char *typeReprStr = JS_EncodeString(cx, &obj->typeDescr().stringRepr());
     if (!typeReprStr)
         return false;
 
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                          errorNumber, typeReprStr);
 
     JS_free(cx, (void *) typeReprStr);
     return false;
 }
 
 /* static */ void
 OutlineTypedObject::obj_trace(JSTracer *trc, JSObject *object)
@@ -1695,17 +1683,17 @@ TypedObject::obj_lookupProperty(JSContex
       case type::Scalar:
       case type::Reference:
       case type::Simd:
         break;
 
       case type::Array:
       {
         uint32_t index;
-        if (js_IdIsIndex(id, &index))
+        if (IdIsIndex(id, &index))
             return obj_lookupElement(cx, obj, index, objp, propp);
 
         if (JSID_IS_ATOM(id, cx->names().length)) {
             MarkNonNativePropertyFound<CanGC>(propp);
             objp.set(obj);
             return true;
         }
         break;
@@ -1753,17 +1741,17 @@ ReportPropertyError(JSContext *cx,
     RootedString str(cx, ValueToSource(cx, idVal));
     if (!str)
         return false;
 
     char *propName = JS_EncodeString(cx, str);
     if (!propName)
         return false;
 
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                          errorNumber, propName);
 
     JS_free(cx, propName);
     return false;
 }
 
 bool
 TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue v,
@@ -1785,17 +1773,17 @@ TypedObject::obj_hasProperty(JSContext *
 
       case type::Array: {
         if (JSID_IS_ATOM(id, cx->names().length)) {
             *foundp = true;
             return true;
         }
         uint32_t index;
         // Elements are not inherited from the prototype.
-        if (js_IdIsIndex(id, &index)) {
+        if (IdIsIndex(id, &index)) {
             *foundp = (index < uint32_t(typedObj->length()));
             return true;
         }
         break;
       }
 
       case type::Struct:
         size_t index;
@@ -1817,34 +1805,34 @@ TypedObject::obj_hasProperty(JSContext *
 bool
 TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver,
                              HandleId id, MutableHandleValue vp)
 {
     Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
 
     // Dispatch elements to obj_getElement:
     uint32_t index;
-    if (js_IdIsIndex(id, &index))
+    if (IdIsIndex(id, &index))
         return obj_getElement(cx, obj, receiver, index, vp);
 
     // Handle everything else here:
 
     switch (typedObj->typeDescr().kind()) {
       case type::Scalar:
       case type::Reference:
         break;
 
       case type::Simd:
         break;
 
       case type::Array:
         if (JSID_IS_ATOM(id, cx->names().length)) {
             if (!typedObj->isAttached()) {
                 JS_ReportErrorNumber(
-                    cx, js_GetErrorMessage,
+                    cx, GetErrorMessage,
                     nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
                 return false;
             }
 
             vp.setInt32(typedObj->length());
             return true;
         }
         break;
@@ -1929,30 +1917,30 @@ TypedObject::obj_setProperty(JSContext *
         break;
 
       case type::Simd:
         break;
 
       case type::Array: {
         if (JSID_IS_ATOM(id, cx->names().length)) {
             if (obj == receiver) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage,
+                JS_ReportErrorNumber(cx, GetErrorMessage,
                                      nullptr, JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
                 return false;
             }
             return SetNonWritableProperty(cx, id, strict);
         }
 
         uint32_t index;
-        if (js_IdIsIndex(id, &index)) {
+        if (IdIsIndex(id, &index)) {
             if (obj != receiver)
                 return SetPropertyByDefining(cx, obj, receiver, id, vp, strict, false);
 
             if (index >= uint32_t(typedObj->length())) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage,
+                JS_ReportErrorNumber(cx, GetErrorMessage,
                                      nullptr, JSMSG_TYPEDOBJECT_BINARYARRAY_BAD_INDEX);
                 return false;
             }
 
             Rooted<TypeDescr*> elementType(cx);
             elementType = &typedObj->typeDescr().as<ArrayTypeDescr>().elementType();
             size_t offset = elementType->size() * index;
             return ConvertAndCopyTo(cx, elementType, typedObj, offset, NullPtr(), vp);
@@ -1981,31 +1969,31 @@ TypedObject::obj_setProperty(JSContext *
 }
 
 bool
 TypedObject::obj_getOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id,
                                           MutableHandle<JSPropertyDescriptor> desc)
 {
     Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
     if (!typedObj->isAttached()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPEDOBJECT_HANDLE_UNATTACHED);
         return false;
     }
 
     Rooted<TypeDescr *> descr(cx, &typedObj->typeDescr());
     switch (descr->kind()) {
       case type::Scalar:
       case type::Reference:
       case type::Simd:
         break;
 
       case type::Array:
       {
         uint32_t index;
-        if (js_IdIsIndex(id, &index)) {
+        if (IdIsIndex(id, &index)) {
             if (!obj_getArrayElement(cx, typedObj, descr, index, desc.value()))
                 return false;
             desc.setAttributes(JSPROP_ENUMERATE | JSPROP_PERMANENT);
             desc.object().set(obj);
             return true;
         }
 
         if (JSID_IS_ATOM(id, cx->names().length)) {
@@ -2047,17 +2035,17 @@ IsOwnId(JSContext *cx, HandleObject obj,
     Rooted<TypedObject *> typedObj(cx, &obj->as<TypedObject>());
     switch (typedObj->typeDescr().kind()) {
       case type::Scalar:
       case type::Reference:
       case type::Simd:
         return false;
 
       case type::Array:
-        return js_IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
+        return IdIsIndex(id, &index) || JSID_IS_ATOM(id, cx->names().length);
 
       case type::Struct:
         size_t index;
         if (typedObj->typeDescr().as<StructTypeDescr>().fieldIndex(id, &index))
             return true;
     }
 
     return false;
@@ -2269,17 +2257,17 @@ LazyArrayBufferTable::maybeBuffer(Inline
     return nullptr;
 }
 
 bool
 LazyArrayBufferTable::addBuffer(JSContext *cx, InlineTransparentTypedObject *obj, ArrayBufferObject *buffer)
 {
     MOZ_ASSERT(!map.has(obj));
     if (!map.put(obj, buffer)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
 
     MOZ_ASSERT(!IsInsideNursery(buffer));
     if (IsInsideNursery(obj)) {
         // Strip the barriers from the type before inserting into the store
         // buffer, as is done for DebugScopes::proxiedScopes.
         Map::Base *baseHashMap = static_cast<Map::Base *>(&map);
@@ -2423,44 +2411,44 @@ TypedObject::construct(JSContext *cx, un
     }
 
     // Buffer constructor.
     if (args[0].isObject() && args[0].toObject().is<ArrayBufferObject>()) {
         Rooted<ArrayBufferObject*> buffer(cx);
         buffer = &args[0].toObject().as<ArrayBufferObject>();
 
         if (callee->opaque() || buffer->isNeutered()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage,
+            JS_ReportErrorNumber(cx, GetErrorMessage,
                                  nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
             return false;
         }
 
         int32_t offset;
         if (args.length() >= 2 && !args[1].isUndefined()) {
             if (!args[1].isInt32()) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage,
+                JS_ReportErrorNumber(cx, GetErrorMessage,
                                      nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
                 return false;
             }
 
             offset = args[1].toInt32();
         } else {
             offset = 0;
         }
 
         if (args.length() >= 3 && !args[2].isUndefined()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage,
+            JS_ReportErrorNumber(cx, GetErrorMessage,
                                  nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
             return false;
         }
 
         if (!CheckOffset(offset, callee->size(), callee->alignment(),
                          buffer->byteLength()))
         {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage,
+            JS_ReportErrorNumber(cx, GetErrorMessage,
                                  nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
             return false;
         }
 
         Rooted<OutlineTypedObject*> obj(cx);
         obj = OutlineTypedObject::createUnattached(cx, callee, LengthForType(*callee));
         if (!obj)
             return false;
@@ -2481,17 +2469,17 @@ TypedObject::construct(JSContext *cx, un
         // Initialize from `arg`.
         if (!ConvertAndCopyTo(cx, obj, args[0]))
             return false;
         args.rval().setObject(*obj);
         return true;
     }
 
     // Something bogus.
-    JS_ReportErrorNumber(cx, js_GetErrorMessage,
+    JS_ReportErrorNumber(cx, GetErrorMessage,
                          nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
     return false;
 }
 
 /******************************************************************************
  * Intrinsics
  */
 
--- a/js/src/builtin/TypedObject.h
+++ b/js/src/builtin/TypedObject.h
@@ -34,17 +34,17 @@
  * http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects or the
  * ES6 spec (not finalized at the time of this writing).
  *
  * - Initialization:
  *
  * Currently, all "globals" related to typed objects are packaged
  * within a single "module" object `TypedObject`. This module has its
  * own js::Class and when that class is initialized, we also create
- * and define all other values (in `js_InitTypedObjectModuleClass()`).
+ * and define all other values (in `js::InitTypedObjectModuleClass()`).
  *
  * - Type objects, meta type objects, and type representations:
  *
  * There are a number of pre-defined type objects, one for each
  * scalar type (`uint8` etc). Each of these has its own class_,
  * defined in `DefineNumericClass()`.
  *
  * There are also meta type objects (`ArrayType`, `StructType`).
@@ -1037,20 +1037,20 @@ class LazyArrayBufferTable
 
     ArrayBufferObject *maybeBuffer(InlineTransparentTypedObject *obj);
     bool addBuffer(JSContext *cx, InlineTransparentTypedObject *obj, ArrayBufferObject *buffer);
 
     void trace(JSTracer *trc);
     size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
 };
 
-} // namespace js
+JSObject *
+InitTypedObjectModuleObject(JSContext *cx, JS::HandleObject obj);
 
-JSObject *
-js_InitTypedObjectModuleObject(JSContext *cx, JS::HandleObject obj);
+} // namespace js
 
 template <>
 inline bool
 JSObject::is<js::SimpleTypeDescr>() const
 {
     return IsSimpleTypeDescrClass(getClass());
 }
 
--- a/js/src/builtin/WeakSetObject.cpp
+++ b/js/src/builtin/WeakSetObject.cpp
@@ -81,17 +81,17 @@ WeakSetObject::construct(JSContext *cx, 
     Rooted<WeakSetObject*> obj(cx, WeakSetObject::create(cx));
     if (!obj)
         return false;
 
     // Based on our "Set" implementation instead of the more general ES6 steps.
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (!args.isConstructing()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_FUNCTION, "WeakSet");
         return false;
     }
 
     if (!args.get(0).isNullOrUndefined()) {
         RootedObject map(cx, &obj->getReservedSlot(WEAKSET_MAP_SLOT).toObject());
 
         RootedValue adderVal(cx);
         if (!GetProperty(cx, obj, obj, cx->names().add, &adderVal))
@@ -121,17 +121,17 @@ WeakSetObject::construct(JSContext *cx, 
             if (done)
                 break;
 
             if (isOriginalAdder) {
                 if (keyVal.isPrimitive()) {
                     char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
                     if (!bytes)
                         return false;
-                    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
+                    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
                     return false;
                 }
 
                 keyObject = &keyVal.toObject();
                 if (!SetWeakMapEntry(cx, map, keyObject, placeholder))
                     return false;
             } else {
                 if (!args2.init(1))
@@ -148,12 +148,12 @@ WeakSetObject::construct(JSContext *cx, 
     }
 
     args.rval().setObject(*obj);
     return true;
 }
 
 
 JSObject *
-js_InitWeakSetClass(JSContext *cx, HandleObject obj)
+js::InitWeakSetClass(JSContext *cx, HandleObject obj)
 {
     return WeakSetObject::initClass(cx, obj);
 }
--- a/js/src/builtin/WeakSetObject.h
+++ b/js/src/builtin/WeakSetObject.h
@@ -22,14 +22,14 @@ class WeakSetObject : public NativeObjec
   private:
     static const JSPropertySpec properties[];
     static const JSFunctionSpec methods[];
 
     static WeakSetObject* create(JSContext *cx);
     static bool construct(JSContext *cx, unsigned argc, Value *vp);
 };
 
+extern JSObject *
+InitWeakSetClass(JSContext *cx, HandleObject obj);
+
 } // namespace js
 
-extern JSObject *
-js_InitWeakSetClass(JSContext *cx, js::HandleObject obj);
-
 #endif /* builtin_WeakSetObject_h */
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -84,17 +84,17 @@ GetDeflatedUTF8StringLength(JSContext *m
         }
     }
     return nbytes;
 
   bad_surrogate:
     if (maybecx) {
         js::gc::AutoSuppressGC suppress(maybecx);
         JS_snprintf(buffer, 10, "0x%x", c);
-        JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, js_GetErrorMessage,
+        JS_ReportErrorFlagsAndNumber(maybecx, JSREPORT_ERROR, GetErrorMessage,
                                      nullptr, JSMSG_BAD_SURROGATE_CHAR, buffer);
     }
     return (size_t) -1;
 }
 
 template size_t
 GetDeflatedUTF8StringLength(JSContext *maybecx, const Latin1Char *chars,
                             size_t nchars);
@@ -146,17 +146,17 @@ DeflateStringToUTF8Buffer(JSContext *may
         }
         if (v < 0x0080) {
             /* no encoding necessary - performance hack */
             if (dstlen == 0)
                 goto bufferTooSmall;
             *dst++ = (char) v;
             utf8Len = 1;
         } else {
-            utf8Len = js_OneUcs4ToUtf8Char(utf8buf, v);
+            utf8Len = js::OneUcs4ToUtf8Char(utf8buf, v);
             if (utf8Len > dstlen)
                 goto bufferTooSmall;
             for (i = 0; i < utf8Len; i++)
                 *dst++ = (char) utf8buf[i];
         }
         dstlen -= utf8Len;
     }
     *dstlenp = (origDstlen - dstlen);
@@ -168,17 +168,17 @@ badSurrogate:
     if (maybecx)
         GetDeflatedUTF8StringLength(maybecx, src - 1, srclen + 1);
     return false;
 
 bufferTooSmall:
     *dstlenp = (origDstlen - dstlen);
     if (maybecx) {
         js::gc::AutoSuppressGC suppress(maybecx);
-        JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr,
                              JSMSG_BUFFER_TOO_SMALL);
     }
     return false;
 }
 
 template bool
 DeflateStringToUTF8Buffer(JSContext *maybecx, const Latin1Char *src, size_t srclen,
                           char *dst, size_t *dstlenp);
@@ -744,18 +744,18 @@ static const JSPropertySpec sFunctionPro
          CTYPESACC_FLAGS),
   JS_PSG("isVariadic",
          (Property<FunctionType::IsFunctionType, FunctionType::IsVariadicGetter>::Fun),
          CTYPESACC_FLAGS),
   JS_PS_END
 };
 
 static const JSFunctionSpec sFunctionInstanceFunctions[] = {
-  JS_FN("call", js_fun_call, 1, CDATAFN_FLAGS),
-  JS_FN("apply", js_fun_apply, 2, CDATAFN_FLAGS),
+  JS_FN("call", js::fun_call, 1, CDATAFN_FLAGS),
+  JS_FN("apply", js::fun_apply, 2, CDATAFN_FLAGS),
   JS_FS_END
 };
 
 static const JSClass sInt64ProtoClass = {
   "Int64",
   0
 };
 
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -29,17 +29,17 @@ using mozilla::Maybe;
 static bool
 CheckLength(ExclusiveContext *cx, SourceBufferHolder &srcBuf)
 {
     // Note this limit is simply so we can store sourceStart and sourceEnd in
     // JSScript as 32-bits. It could be lifted fairly easily, since the compiler
     // is using size_t internally already.
     if (srcBuf.length() > UINT32_MAX) {
         if (cx->isJSContext())
-            JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
                                  JSMSG_SOURCE_TOO_LONG);
         return false;
     }
     return true;
 }
 
 static bool
 SetDisplayURL(ExclusiveContext *cx, TokenStream &tokenStream, ScriptSource *ss)
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -204,17 +204,17 @@ EmitCheck(ExclusiveContext *cx, Bytecode
 
     // Start it off moderately large to avoid repeated resizings early on.
     // ~98% of cases fit within 1024 bytes.
     if (bce->code().capacity() == 0 && !bce->code().reserve(1024))
         return -1;
 
     jsbytecode dummy = 0;
     if (!bce->code().appendN(dummy, delta)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return -1;
     }
     return offset;
 }
 
 static void
 UpdateDepth(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t target)
 {
@@ -2813,17 +2813,17 @@ EmitSwitch(ExclusiveContext *cx, Bytecod
                     size_t(i) < (INTMAP_LENGTH * JS_BITMAP_NBITS)) {
                     intmap = intmap_space;
                     intmap_bitlen = INTMAP_LENGTH * JS_BITMAP_NBITS;
                 } else {
                     /* Just grab 8K for the worst-case bitmap. */
                     intmap_bitlen = JS_BIT(16);
                     intmap = cx->pod_malloc<jsbitmap>(JS_BIT(16) / JS_BITMAP_NBITS);
                     if (!intmap) {
-                        js_ReportOutOfMemory(cx);
+                        ReportOutOfMemory(cx);
                         return false;
                     }
                 }
                 memset(intmap, 0, size_t(intmap_bitlen) / CHAR_BIT);
             }
             if (JS_TEST_BIT(intmap, i)) {
                 switchOp = JSOP_CONDSWITCH;
                 continue;
@@ -7476,17 +7476,17 @@ AllocSrcNote(ExclusiveContext *cx, SrcNo
 {
     // Start it off moderately large to avoid repeated resizings early on.
     // ~99% of cases fit within 256 bytes.
     if (notes.capacity() == 0 && !notes.reserve(256))
         return -1;
 
     jssrcnote dummy = 0;
     if (!notes.append(dummy)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return -1;
     }
     return notes.length() - 1;
 }
 
 int
 frontend::NewSrcNote(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type)
 {
@@ -7610,17 +7610,17 @@ SetSrcNoteOffset(ExclusiveContext *cx, B
         /* Maybe this offset was already set to a four-byte value. */
         if (!(*sn & SN_4BYTE_OFFSET_FLAG)) {
             /* Insert three dummy bytes that will be overwritten shortly. */
             jssrcnote dummy = 0;
             if (!(sn = notes.insert(sn, dummy)) ||
                 !(sn = notes.insert(sn, dummy)) ||
                 !(sn = notes.insert(sn, dummy)))
             {
-                js_ReportOutOfMemory(cx);
+                ReportOutOfMemory(cx);
                 return false;
             }
         }
         *sn++ = (jssrcnote)(SN_4BYTE_OFFSET_FLAG | (offset >> 24));
         *sn++ = (jssrcnote)(offset >> 16);
         *sn++ = (jssrcnote)(offset >> 8);
     }
     *sn = (jssrcnote)offset;
--- a/js/src/frontend/NameFunctions.cpp
+++ b/js/src/frontend/NameFunctions.cpp
@@ -43,17 +43,17 @@ class NameResolver
      * front end will produce a PNK_DOT with a PNK_NAME child whose name
      * contains spaces.
      */
     bool appendPropertyReference(JSAtom *name) {
         if (IsIdentifier(name))
             return buf->append('.') && buf->append(name);
 
         /* Quote the string as needed. */
-        JSString *source = js_QuoteString(cx, name, '"');
+        JSString *source = QuoteString(cx, name, '"');
         return source && buf->append('[') && buf->append(source) && buf->append(']');
     }
 
     /* Append a number to buf. */
     bool appendNumber(double n) {
         char number[30];
         int digits = JS_snprintf(number, sizeof(number), "%g", n);
         return buf->append(number, digits);
--- a/js/src/frontend/ParseMaps.cpp
+++ b/js/src/frontend/ParseMaps.cpp
@@ -57,17 +57,17 @@ ParseMapPool::allocateFresh()
     return (void *) map;
 }
 
 DefinitionList::Node *
 DefinitionList::allocNode(ExclusiveContext *cx, LifoAlloc &alloc, uintptr_t head, Node *tail)
 {
     Node *result = alloc.new_<Node>(head, tail);
     if (!result)
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
     return result;
 }
 
 #ifdef DEBUG
 template <typename ParseHandler>
 void
 AtomDecls<ParseHandler>::dump()
 {
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -564,17 +564,17 @@ ParseNodeAllocator::allocNode()
 {
     if (ParseNode *pn = freelist) {
         freelist = pn->pn_next;
         return pn;
     }
 
     void *p = alloc.alloc(sizeof (ParseNode));
     if (!p)
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
     return p;
 }
 
 ParseNode *
 ParseNode::appendOrCreateList(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right,
                               FullParseHandler *handler, ParseContext<FullParseHandler> *pc)
 {
     // The asm.js specification is written in ECMAScript grammar terms that
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -390,17 +390,17 @@ ParseContext<ParseHandler>::generateFunc
         Definition *dn = bodyLevelLexicals_[i];
         if (!dn->pn_cookie.set(ts, dn->pn_cookie.level(), vars_.length() + i))
             return false;
     }
 
     uint32_t count = args_.length() + vars_.length() + bodyLevelLexicals_.length();
     Binding *packedBindings = alloc.newArrayUninitialized<Binding>(count);
     if (!packedBindings) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
 
     uint32_t numUnaliasedVars = 0;
     uint32_t numUnaliasedBodyLevelLexicals = 0;
 
     AppendPackedBindings(this, args_, packedBindings);
     AppendPackedBindings(this, vars_, packedBindings + args_.length(), &numUnaliasedVars);
@@ -571,17 +571,17 @@ Parser<ParseHandler>::newObjectBox(Nativ
      * on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
      * arenas containing the entries must be alive until we are done with
      * scanning, parsing and code generation for the whole script or top-level
      * function.
      */
 
     ObjectBox *objbox = alloc.new_<ObjectBox>(obj, traceListHead);
     if (!objbox) {
-        js_ReportOutOfMemory(context);
+        ReportOutOfMemory(context);
         return nullptr;
     }
 
     traceListHead = objbox;
 
     return objbox;
 }
 
@@ -668,17 +668,17 @@ Parser<ParseHandler>::newFunctionBox(Nod
      * scanning, parsing and code generation for the whole script or top-level
      * function.
      */
     FunctionBox *funbox =
         alloc.new_<FunctionBox>(context, traceListHead, fun, outerpc,
                                 inheritedDirectives, options().extraWarningsOption,
                                 generatorKind);
     if (!funbox) {
-        js_ReportOutOfMemory(context);
+        ReportOutOfMemory(context);
         return nullptr;
     }
 
     traceListHead = funbox;
     if (fn)
         handler.setFunctionBox(fn, funbox);
 
     return funbox;
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -569,17 +569,17 @@ CompileError::throwError(JSContext *cx)
     //
     // If an exception is thrown but not caught, the JSREPORT_EXCEPTION
     // flag will be set in report.flags.  Proper behavior for an error
     // reporter is to ignore a report with this flag for all but top-level
     // compilation errors.  The exception will remain pending, and so long
     // as the non-top-level "load", "eval", or "compile" native function
     // returns false, the top-level reporter will eventually receive the
     // uncaught exception report.
-    if (!js_ErrorToException(cx, message, &report, nullptr, nullptr))
+    if (!ErrorToException(cx, message, &report, nullptr, nullptr))
         CallErrorReporter(cx, message, &report);
 }
 
 CompileError::~CompileError()
 {
     js_free((void*)report.uclinebuf);
     js_free((void*)report.linebuf);
     js_free((void*)report.ucmessage);
@@ -636,18 +636,18 @@ TokenStream::reportCompileErrorNumberVA(
             callerFilename = true;
             err.report.filename = iter.scriptFilename();
             err.report.lineno = iter.computeLine(&err.report.column);
         }
     }
 
     err.argumentsType = (flags & JSREPORT_UC) ? ArgumentsAreUnicode : ArgumentsAreASCII;
 
-    if (!js_ExpandErrorArguments(cx, js_GetErrorMessage, nullptr, errorNumber, &err.message,
-                                 &err.report, err.argumentsType, args))
+    if (!ExpandErrorArguments(cx, GetErrorMessage, nullptr, errorNumber, &err.message,
+                              &err.report, err.argumentsType, args))
     {
         return false;
     }
 
     // Given a token, T, that we want to complain about: if T's (starting)
     // lineno doesn't match TokenStream's lineno, that means we've scanned past
     // the line that T starts on, which makes it hard to print some or all of
     // T's (starting) line for context.
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -922,17 +922,17 @@ gc::MarkArraySlots(JSTracer *trc, size_t
     }
 }
 
 void
 gc::MarkObjectSlots(JSTracer *trc, NativeObject *obj, uint32_t start, uint32_t nslots)
 {
     MOZ_ASSERT(obj->isNative());
     for (uint32_t i = start; i < (start + nslots); ++i) {
-        trc->setTracingDetails(js_GetObjectSlotName, obj, i);
+        trc->setTracingDetails(GetObjectSlotName, obj, i);
         MarkValueInternal(trc, obj->getSlotRef(i).unsafeGet());
     }
 }
 
 static bool
 ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell)
 {
     if (!IS_GC_MARKING_TRACER(trc))
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -131,17 +131,17 @@ struct Zone : public JS::shadow::Zone,
     }
 
     bool isTooMuchMalloc() const { return gcMallocBytes <= 0; }
     void onTooMuchMalloc();
 
     void *onOutOfMemory(void *p, size_t nbytes) {
         return runtimeFromMainThread()->onOutOfMemory(p, nbytes);
     }
-    void reportAllocationOverflow() { js_ReportAllocationOverflow(nullptr); }
+    void reportAllocationOverflow() { js::ReportAllocationOverflow(nullptr); }
 
     void beginSweepTypes(js::FreeOp *fop, bool releaseTypes);
 
     bool hasMarkedCompartments();
 
     void scheduleGC() { MOZ_ASSERT(!runtimeFromMainThread()->isHeapBusy()); gcScheduled_ = true; }
     void unscheduleGC() { gcScheduled_ = false; }
     bool isGCScheduled() { return gcScheduled_ && canCollect(); }
--- a/js/src/irregexp/RegExpInterpreter.cpp
+++ b/js/src/irregexp/RegExpInterpreter.cpp
@@ -44,29 +44,29 @@ class MOZ_STACK_CLASS RegExpStackCursor
 {
   public:
     explicit RegExpStackCursor(JSContext *cx)
       : cx(cx), cursor(nullptr)
     {}
 
     bool init() {
         if (!stack.init()) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
         cursor = base();
         return true;
     }
 
     bool push(int32_t value) {
         *cursor++ = value;
         if (cursor >= stack.limit()) {
             int32_t pos = position();
             if (!stack.grow()) {
-                js_ReportOverRecursed(cx);
+                ReportOverRecursed(cx);
                 return false;
             }
             setPosition(pos);
         }
         return true;
     }
 
     int32_t pop() {
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -1088,17 +1088,17 @@ ICTypeMonitor_Fallback::addMonitorStubFo
                     return true;
             }
         }
 
         ICTypeMonitor_PrimitiveSet::Compiler compiler(cx, existingStub, type);
         ICStub *stub = existingStub ? compiler.updateStub()
                                     : compiler.getStub(compiler.getStubSpace(script));
         if (!stub) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
 
         JitSpew(JitSpew_BaselineIC, "  %s TypeMonitor stub %p for primitive type %d",
                 existingStub ? "Modified existing" : "Created new", stub, type);
 
         if (!existingStub) {
             MOZ_ASSERT(!hasStub(TypeMonitor_PrimitiveSet));
@@ -1115,17 +1115,17 @@ ICTypeMonitor_Fallback::addMonitorStubFo
             {
                 return true;
             }
         }
 
         ICTypeMonitor_SingleObject::Compiler compiler(cx, obj);
         ICStub *stub = compiler.getStub(compiler.getStubSpace(script));
         if (!stub) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
 
         JitSpew(JitSpew_BaselineIC, "  Added TypeMonitor stub %p for singleton %p",
                 stub, obj.get());
 
         addOptimizedMonitorStub(stub);
 
@@ -1139,17 +1139,17 @@ ICTypeMonitor_Fallback::addMonitorStubFo
             {
                 return true;
             }
         }
 
         ICTypeMonitor_ObjectGroup::Compiler compiler(cx, group);
         ICStub *stub = compiler.getStub(compiler.getStubSpace(script));
         if (!stub) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
 
         JitSpew(JitSpew_BaselineIC, "  Added TypeMonitor stub %p for ObjectGroup %p",
                 stub, group.get());
 
         addOptimizedMonitorStub(stub);
     }
@@ -5639,17 +5639,17 @@ ICSetElem_TypedArray::Compiler::generate
 
 static bool
 DoInFallback(JSContext *cx, ICIn_Fallback *stub, HandleValue key, HandleValue objValue,
              MutableHandleValue res)
 {
     FallbackICSpew(cx, stub, "In");
 
     if (!objValue.isObject()) {
-        js_ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, objValue, NullPtr());
+        ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, objValue, NullPtr());
         return false;
     }
 
     RootedObject obj(cx, &objValue.toObject());
 
     bool cond = false;
     if (!OperatorIn(cx, key, obj, &cond))
         return false;
@@ -9088,17 +9088,17 @@ TryAttachFunCallStub(JSContext *cx, ICCa
 
 static bool
 GetTemplateObjectForNative(JSContext *cx, HandleScript script, jsbytecode *pc,
                            Native native, const CallArgs &args, MutableHandleObject res)
 {
     // Check for natives to which template objects can be attached. This is
     // done to provide templates to Ion for inlining these natives later on.
 
-    if (native == js_Array) {
+    if (native == ArrayConstructor) {
         // Note: the template array won't be used if its length is inaccurately
         // computed here.  (We allocate here because compilation may occur on a
         // separate thread where allocation is impossible.)
         size_t count = 0;
         if (args.length() != 1)
             count = args.length();
         else if (args.length() == 1 && args[0].isInt32() && args[0].toInt32() >= 0)
             count = args[0].toInt32();
@@ -9145,17 +9145,17 @@ GetTemplateObjectForNative(JSContext *cx
 
         ObjectGroup *group = ObjectGroup::allocationSiteGroup(cx, script, pc, JSProto_Array);
         if (!group)
             return false;
         res->setGroup(group);
         return true;
     }
 
-    if (native == js_String) {
+    if (native == StringConstructor) {
         RootedString emptyString(cx, cx->runtime()->emptyString);
         res.set(StringObject::create(cx, emptyString, TenuredObject));
         return !!res;
     }
 
     if (native == obj_create && args.length() == 1 && args[0].isObjectOrNull()) {
         RootedObject proto(cx, args[0].toObjectOrNull());
         res.set(ObjectCreateImpl(cx, proto, TenuredObject));
@@ -9393,25 +9393,25 @@ TryAttachCallStub(JSContext *cx, ICCall_
     }
 
     if (fun->isNative() && (!constructing || (constructing && fun->isNativeConstructor()))) {
         // Generalized native call stubs are not here yet!
         MOZ_ASSERT(!stub->nativeStubsAreGeneralized());
 
         // Check for JSOP_FUNAPPLY
         if (op == JSOP_FUNAPPLY) {
-            if (fun->native() == js_fun_apply)
+            if (fun->native() == fun_apply)
                 return TryAttachFunApplyStub(cx, stub, script, pc, thisv, argc, vp + 2, handled);
 
             // Don't try to attach a "regular" optimized call stubs for FUNAPPLY ops,
             // since MagicArguments may escape through them.
             return true;
         }
 
-        if (op == JSOP_FUNCALL && fun->native() == js_fun_call) {
+        if (op == JSOP_FUNCALL && fun->native() == fun_call) {
             if (!TryAttachFunCallStub(cx, stub, script, pc, thisv, handled))
                 return false;
             if (*handled)
                 return true;
         }
 
         if (stub->nativeStubCount() >= ICCall_Fallback::MAX_NATIVE_STUBS) {
             JitSpew(JitSpew_BaselineIC,
@@ -9813,29 +9813,29 @@ ICCallStubCompiler::guardFunApply(MacroA
         masm.addPtr(Imm32(sizeof(Value)), start);
         masm.jump(&loop);
         masm.bind(&endLoop);
     }
 
     // Stack now confirmed to be like:
     //      [..., CalleeV, ThisV, Arg0V, MagicValue(Arguments), <MaybeReturnAddr>]
 
-    // Load the callee, ensure that it's js_fun_apply
+    // Load the callee, ensure that it's fun_apply
     ValueOperand val = regs.takeAnyValue();
     Address calleeSlot(BaselineStackReg, ICStackValueOffset + (3 * sizeof(Value)));
     masm.loadValue(calleeSlot, val);
 
     masm.branchTestObject(Assembler::NotEqual, val, failure);
     Register callee = masm.extractObject(val, ExtractTemp1);
 
     masm.branchTestObjClass(Assembler::NotEqual, callee, regs.getAny(), &JSFunction::class_,
                             failure);
     masm.loadPtr(Address(callee, JSFunction::offsetOfNativeOrScript()), callee);
 
-    masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(js_fun_apply), failure);
+    masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(fun_apply), failure);
 
     // Load the |thisv|, ensure that it's a scripted function with a valid baseline or ion
     // script, or a native function.
     Address thisSlot(BaselineStackReg, ICStackValueOffset + (2 * sizeof(Value)));
     masm.loadValue(thisSlot, val);
 
     masm.branchTestObject(Assembler::NotEqual, val, failure);
     Register target = masm.extractObject(val, ExtractTemp1);
@@ -10653,26 +10653,26 @@ ICCall_ScriptedApplyArray::Compiler::gen
 
     //
     // Push arguments
     //
 
     // Stack now looks like:
     //                                      BaselineFrameReg -------------------.
     //                                                                          v
-    //      [..., js_fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader]
+    //      [..., fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader]
 
     // Push all array elements onto the stack:
     Address arrayVal(BaselineFrameReg, STUB_FRAME_SIZE);
     pushArrayArguments(masm, arrayVal, regs);
 
     // Stack now looks like:
     //                                      BaselineFrameReg -------------------.
     //                                                                          v
-    //      [..., js_fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader,
+    //      [..., fun_apply, TargetV, TargetThisV, ArgsArrayV, StubFrameHeader,
     //       PushedArgN, ..., PushedArg0]
     // Can't fail after this, so it's ok to clobber argcReg.
 
     // Push actual argument 0 as |thisv| for call.
     masm.pushValue(Address(BaselineFrameReg, STUB_FRAME_SIZE + sizeof(Value)));
 
     // All pushes after this use Push instead of push to make sure ARM can align
     // stack properly for call.
@@ -10753,25 +10753,25 @@ ICCall_ScriptedApplyArguments::Compiler:
     // Push a stub frame so that we can perform a non-tail call.
     enterStubFrame(masm, regs.getAny());
 
     //
     // Push arguments
     //
 
     // Stack now looks like:
-    //      [..., js_fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader]
+    //      [..., fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader]
 
     // Push all arguments supplied to caller function onto the stack.
     pushCallerArguments(masm, regs);
 
     // Stack now looks like:
     //                                      BaselineFrameReg -------------------.
     //                                                                          v
-    //      [..., js_fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader,
+    //      [..., fun_apply, TargetV, TargetThisV, MagicArgsV, StubFrameHeader,
     //       PushedArgN, ..., PushedArg0]
     // Can't fail after this, so it's ok to clobber argcReg.
 
     // Push actual argument 0 as |thisv| for call.
     masm.pushValue(Address(BaselineFrameReg, STUB_FRAME_SIZE + sizeof(Value)));
 
     // All pushes after this use Push instead of push to make sure ARM can align
     // stack properly for call.
@@ -10834,24 +10834,24 @@ ICCall_ScriptedFunCall::Compiler::genera
     regs.takeUnchecked(BaselineTailCallReg);
 
     // Load the callee in R1.
     // Stack Layout: [ ..., CalleeVal, ThisVal, Arg0Val, ..., ArgNVal, +ICStackValueOffset+ ]
     BaseValueIndex calleeSlot(BaselineStackReg, argcReg, ICStackValueOffset + sizeof(Value));
     masm.loadValue(calleeSlot, R1);
     regs.take(R1);
 
-    // Ensure callee is js_fun_call.
+    // Ensure callee is fun_call.
     masm.branchTestObject(Assembler::NotEqual, R1, &failure);
 
     Register callee = masm.extractObject(R1, ExtractTemp0);
     masm.branchTestObjClass(Assembler::NotEqual, callee, regs.getAny(), &JSFunction::class_,
                             &failure);
     masm.loadPtr(Address(callee, JSFunction::offsetOfNativeOrScript()), callee);
-    masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(js_fun_call), &failure);
+    masm.branchPtr(Assembler::NotEqual, callee, ImmPtr(fun_call), &failure);
 
     // Ensure |this| is a scripted function with JIT code.
     BaseIndex thisSlot(BaselineStackReg, argcReg, TimesEight, ICStackValueOffset);
     masm.loadValue(thisSlot, R1);
 
     masm.branchTestObject(Assembler::NotEqual, R1, &failure);
     callee = masm.extractObject(R1, ExtractTemp0);
 
@@ -11260,17 +11260,17 @@ TryAttachInstanceOfStub(JSContext *cx, B
 
 static bool
 DoInstanceOfFallback(JSContext *cx, BaselineFrame *frame, ICInstanceOf_Fallback *stub,
                      HandleValue lhs, HandleValue rhs, MutableHandleValue res)
 {
     FallbackICSpew(cx, stub, "InstanceOf");
 
     if (!rhs.isObject()) {
-        js_ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rhs, NullPtr());
+        ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, -1, rhs, NullPtr());
         return false;
     }
 
     RootedObject obj(cx, &rhs.toObject());
     bool cond = false;
     if (!HasInstance(cx, obj, lhs, &cond))
         return false;
 
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -752,17 +752,17 @@ IonScript::New(JSContext *cx, RecompileI
                size_t runtimeSize,  size_t safepointsSize,
                size_t backedgeEntries, OptimizationLevel optimizationLevel)
 {
     static const int DataAlignment = sizeof(void *);
 
     if (snapshotsListSize >= MAX_BUFFER_SIZE ||
         (bailoutEntries >= MAX_BUFFER_SIZE / sizeof(uint32_t)))
     {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     // This should not overflow on x86, because the memory is already allocated
     // *somewhere* and if their total overflowed there would be no memory left
     // at all.
     size_t paddedSnapshotsSize = AlignBytes(snapshotsListSize + snapshotsRVATableSize, DataAlignment);
     size_t paddedRecoversSize = AlignBytes(recoversSize, DataAlignment);
@@ -2106,17 +2106,17 @@ Compile(JSContext *cx, HandleScript scri
                                     recompile, optimizationLevel);
     if (reason == AbortReason_Error)
         return Method_Error;
 
     if (reason == AbortReason_Disable)
         return Method_CantCompile;
 
     if (reason == AbortReason_Alloc) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return Method_Error;
     }
 
     // Compilation succeeded or we invalidated right away or an inlining/alloc abort
     if (script->hasIonScript())
         return Method_Compiled;
     return Method_Skipped;
 }
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -3183,17 +3183,17 @@ jit::AnalyzeNewScriptDefiniteProperties(
                      Analysis_DefiniteProperties,
                      script->needsArgsObj(),
                      inlineScriptTree);
 
     const OptimizationInfo *optimizationInfo = js_IonOptimizations.get(Optimization_Normal);
 
     CompilerConstraintList *constraints = NewCompilerConstraintList(temp);
     if (!constraints) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
 
     BaselineInspector inspector(script);
     const JitCompileOptions options(cx);
 
     IonBuilder builder(cx, CompileCompartment::get(cx->compartment()), options, &temp, &graph, constraints,
                        &inspector, &info, optimizationInfo, /* baselineFrame = */ nullptr);
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -5654,17 +5654,17 @@ IonBuilder::jsop_funcall(uint32_t argc)
     // argc+2: The native 'call' function.
 
     int calleeDepth = -((int)argc + 2);
     int funcDepth = -((int)argc + 1);
 
     // If |Function.prototype.call| may be overridden, don't optimize callsite.
     TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
     JSFunction *native = getSingleCallTarget(calleeTypes);
-    if (!native || !native->isNative() || native->native() != &js_fun_call) {
+    if (!native || !native->isNative() || native->native() != &fun_call) {
         CallInfo callInfo(alloc(), false);
         if (!callInfo.init(current, argc))
             return false;
         return makeCall(native, callInfo);
     }
     current->peek(calleeDepth)->setImplicitlyUsedUnchecked();
 
     // Extract call target.
@@ -5737,17 +5737,17 @@ IonBuilder::jsop_funapply(uint32_t argc)
     if (argument->type() != MIRType_MagicOptimizedArguments) {
         CallInfo callInfo(alloc(), false);
         if (!callInfo.init(current, argc))
             return false;
         return makeCall(native, callInfo);
     }
 
     if ((!native || !native->isNative() ||
-        native->native() != js_fun_apply) &&
+        native->native() != fun_apply) &&
         info().analysisMode() != Analysis_DefiniteProperties)
     {
         return abort("fun.apply speculation failed");
     }
 
     // Use funapply that definitely uses |arguments|
     return jsop_funapplyarguments(argc);
 }
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -881,17 +881,17 @@ HandleException(ResumeFromException *rfe
             // not crash when accessing an IonScript that's destroyed by the
             // ionScript->decref call.
             EnsureExitFrame(current);
             cx->runtime()->jitTop = (uint8_t *)current;
         }
 
         if (overrecursed) {
             // We hit an overrecursion error during bailout. Report it now.
-            js_ReportOverRecursed(cx);
+            ReportOverRecursed(cx);
         }
     }
 
     rfe->stackPointer = iter.fp();
 }
 
 void
 EnsureExitFrame(CommonFrameLayout *frame)
--- a/js/src/jit/Linker.h
+++ b/js/src/jit/Linker.h
@@ -19,17 +19,17 @@
 namespace js {
 namespace jit {
 
 class Linker
 {
     MacroAssembler &masm;
 
     JitCode *fail(JSContext *cx) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
   public:
     explicit Linker(MacroAssembler &masm)
       : masm(masm)
     {
         masm.finish();
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -59,17 +59,17 @@ IonBuilder::inlineNativeCall(CallInfo &c
         native == atomics_and ||
         native == atomics_or ||
         native == atomics_xor)
     {
         return inlineAtomicsBinop(callInfo, target);
     }
 
     // Array natives.
-    if (native == js_Array)
+    if (native == ArrayConstructor)
         return inlineArray(callInfo);
     if (native == js::array_pop)
         return inlineArrayPopShift(callInfo, MArrayPopShift::Pop);
     if (native == js::array_shift)
         return inlineArrayPopShift(callInfo, MArrayPopShift::Shift);
     if (native == js::array_push)
         return inlineArrayPush(callInfo);
     if (native == js::array_concat)
@@ -147,25 +147,25 @@ IonBuilder::inlineNativeCall(CallInfo &c
     if (native == js::math_sign)
         return inlineMathFunction(callInfo, MMathFunction::Sign);
     if (native == js::math_trunc)
         return inlineMathFunction(callInfo, MMathFunction::Trunc);
     if (native == js::math_cbrt)
         return inlineMathFunction(callInfo, MMathFunction::Cbrt);
 
     // String natives.
-    if (native == js_String)
+    if (native == StringConstructor)
         return inlineStringObject(callInfo);
-    if (native == js::str_split)
+    if (native == str_split)
         return inlineStringSplit(callInfo);
-    if (native == js_str_charCodeAt)
+    if (native == str_charCodeAt)
         return inlineStrCharCodeAt(callInfo);
-    if (native == js::str_fromCharCode)
+    if (native == str_fromCharCode)
         return inlineStrFromCharCode(callInfo);
-    if (native == js_str_charAt)
+    if (native == str_charAt)
         return inlineStrCharAt(callInfo);
     if (native == str_replace)
         return inlineStrReplace(callInfo);
 
     // RegExp natives.
     if (native == regexp_exec && CallResultEscapes(pc))
         return inlineRegExpExec(callInfo);
     if (native == regexp_exec && !CallResultEscapes(pc))
@@ -380,17 +380,17 @@ IonBuilder::inlineMathFunction(CallInfo 
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineArray(CallInfo &callInfo)
 {
     uint32_t initLength = 0;
     AllocatingBehaviour allocating = NewArray_Unallocating;
 
-    JSObject *templateObject = inspector->getTemplateObjectForNative(pc, js_Array);
+    JSObject *templateObject = inspector->getTemplateObjectForNative(pc, ArrayConstructor);
     if (!templateObject) {
         trackOptimizationOutcome(TrackedOutcome::CantInlineNativeNoTemplateObj);
         return InliningStatus_NotInlined;
     }
     ArrayObject *templateArray = &templateObject->as<ArrayObject>();
 
     // Multiple arguments imply array initialization, not just construction.
     if (callInfo.argc() >= 2) {
@@ -1357,17 +1357,17 @@ IonBuilder::inlineStringObject(CallInfo 
         trackOptimizationOutcome(TrackedOutcome::CantInlineNativeBadForm);
         return InliningStatus_NotInlined;
     }
 
     // ConvertToString doesn't support objects.
     if (callInfo.getArg(0)->mightBeType(MIRType_Object))
         return InliningStatus_NotInlined;
 
-    JSObject *templateObj = inspector->getTemplateObjectForNative(pc, js_String);
+    JSObject *templateObj = inspector->getTemplateObjectForNative(pc, StringConstructor);
     if (!templateObj)
         return InliningStatus_NotInlined;
     MOZ_ASSERT(templateObj->is<StringObject>());
 
     callInfo.setImplicitlyUsedUnchecked();
 
     MNewStringObject *ins = MNewStringObject::New(alloc(), callInfo.getArg(0), templateObj);
     current->add(ins);
--- a/js/src/jit/MacroAssembler.cpp
+++ b/js/src/jit/MacroAssembler.cpp
@@ -1378,19 +1378,19 @@ MacroAssembler::loadStringChar(Register 
 void
 MacroAssembler::linkExitFrame()
 {
     AbsoluteAddress jitTop(GetJitContext()->runtime->addressOfJitTop());
     storePtr(StackPointer, jitTop);
 }
 
 static void
-ReportOverRecursed(JSContext *cx)
+BailoutReportOverRecursed(JSContext *cx)
 {
-    js_ReportOverRecursed(cx);
+    ReportOverRecursed(cx);
 }
 
 void
 MacroAssembler::generateBailoutTail(Register scratch, Register bailoutInfo)
 {
     enterExitFrame();
 
     Label baseline;
@@ -1406,17 +1406,17 @@ MacroAssembler::generateBailoutTail(Regi
     branch32(Equal, ReturnReg, Imm32(BAILOUT_RETURN_OK), &baseline);
     branch32(Equal, ReturnReg, Imm32(BAILOUT_RETURN_FATAL_ERROR), exceptionLabel());
 
     // Fall-through: overrecursed.
     {
         loadJSContext(ReturnReg);
         setupUnalignedABICall(1, scratch);
         passABIArg(ReturnReg);
-        callWithABI(JS_FUNC_TO_DATA_PTR(void *, ReportOverRecursed));
+        callWithABI(JS_FUNC_TO_DATA_PTR(void *, BailoutReportOverRecursed));
         jump(exceptionLabel());
     }
 
     bind(&baseline);
     {
         // Prepare a register set for use in this case.
         GeneralRegisterSet regs(GeneralRegisterSet::All());
         MOZ_ASSERT(!regs.has(BaselineStackReg));
--- a/js/src/jit/arm/Simulator-arm.h
+++ b/js/src/jit/arm/Simulator-arm.h
@@ -428,17 +428,17 @@ class Simulator
         MOZ_ASSERT(cacheLockHolder_);
         redirection_ = redirection;
     }
 };
 
 #define JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, onerror)             \
     JS_BEGIN_MACRO                                                              \
         if (cx->runtime()->simulator()->overRecursedWithExtra(extra)) {         \
-            js_ReportOverRecursed(cx);                                          \
+            js::ReportOverRecursed(cx);                                         \
             onerror;                                                            \
         }                                                                       \
     JS_END_MACRO
 
 } // namespace jit
 } // namespace js
 
 #endif /* JS_ARM_SIMULATOR */
--- a/js/src/jit/mips/Simulator-mips.h
+++ b/js/src/jit/mips/Simulator-mips.h
@@ -403,17 +403,17 @@ class Simulator {
         MOZ_ASSERT(cacheLockHolder_);
         redirection_ = redirection;
     }
 };
 
 #define JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, onerror)             \
     JS_BEGIN_MACRO                                                              \
         if (cx->mainThread().simulator()->overRecursedWithExtra(extra)) {       \
-            js_ReportOverRecursed(cx);                                          \
+            js::ReportOverRecursed(cx);                                         \
             onerror;                                                            \
         }                                                                       \
     JS_END_MACRO
 
 } // namespace jit
 } // namespace js
 
 #endif /* JS_MIPS_SIMULATOR */
--- a/js/src/jsalloc.cpp
+++ b/js/src/jsalloc.cpp
@@ -14,10 +14,10 @@ void *
 TempAllocPolicy::onOutOfMemory(void *p, size_t nbytes)
 {
     return static_cast<ExclusiveContext *>(cx_)->onOutOfMemory(p, nbytes);
 }
 
 void
 TempAllocPolicy::reportAllocOverflow() const
 {
-    js_ReportAllocationOverflow(static_cast<ExclusiveContext *>(cx_));
+    ReportAllocationOverflow(static_cast<ExclusiveContext *>(cx_));
 }
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -115,17 +115,17 @@ using js::frontend::Parser;
 #define JS_ADDRESSOF_VA_LIST(ap) (&(ap))
 #endif
 
 bool
 JS::CallArgs::requireAtLeast(JSContext *cx, const char *fnname, unsigned required) {
     if (length() < required) {
         char numArgsStr[40];
         JS_snprintf(numArgsStr, sizeof numArgsStr, "%u", required - 1);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              fnname, numArgsStr, required == 2 ? "" : "s");
         return false;
     }
 
     return true;
 }
 
 JS_PUBLIC_API(int64_t)
@@ -1609,18 +1609,18 @@ JS_PUBLIC_API(JSObject *)
 JS_InitClass(JSContext *cx, HandleObject obj, HandleObject parent_proto,
              const JSClass *clasp, JSNative constructor, unsigned nargs,
              const JSPropertySpec *ps, const JSFunctionSpec *fs,
              const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj, parent_proto);
-    return js_InitClass(cx, obj, parent_proto, Valueify(clasp), constructor,
-                        nargs, ps, fs, static_ps, static_fs);
+    return InitClass(cx, obj, parent_proto, Valueify(clasp), constructor,
+                     nargs, ps, fs, static_ps, static_fs);
 }
 
 JS_PUBLIC_API(bool)
 JS_LinkConstructorAndPrototype(JSContext *cx, HandleObject ctor, HandleObject proto)
 {
     return LinkConstructorAndPrototype(cx, ctor, proto);
 }
 
@@ -1693,17 +1693,17 @@ JS_SetPrototype(JSContext *cx, JS::Handl
     assertSameCompartment(cx, obj, proto);
 
     bool succeeded;
     if (!SetPrototype(cx, obj, proto, &succeeded))
         return false;
 
     if (!succeeded) {
         RootedValue val(cx, ObjectValue(*obj));
-        js_ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, val, js::NullPtr());
+        ReportValueError(cx, JSMSG_SETPROTOTYPEOF_FAIL, JSDVG_IGNORE_STACK, val, js::NullPtr());
         return false;
     }
 
     return true;
 }
 
 JS_PUBLIC_API(bool)
 JS_IsExtensible(JSContext *cx, HandleObject obj, bool *extensible)
@@ -1742,17 +1742,17 @@ JS_GetConstructor(JSContext *cx, HandleO
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, proto);
 
     RootedValue cval(cx);
     if (!GetProperty(cx, proto, proto, cx->names().constructor, &cval))
         return nullptr;
     if (!IsFunctionObject(cval)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
                              proto->getClass()->name);
         return nullptr;
     }
     return &cval.toObject();
 }
 
 bool
 JS::CompartmentOptions::extraWarnings(JSRuntime *rt) const
@@ -3142,27 +3142,27 @@ CloneFunctionObject(JSContext *cx, Handl
     RootedFunction fun(cx, &funobj->as<JSFunction>());
     if (fun->isInterpretedLazy()) {
         AutoCompartment ac(cx, funobj);
         if (!fun->getOrCreateScript(cx))
             return nullptr;
     }
 
     if (!IsFunctionCloneable(fun, dynamicScope)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
         return nullptr;
     }
 
     if (fun->isBoundFunction()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
         return nullptr;
     }
 
     if (fun->isNative() && IsAsmJSModuleNative(fun->native())) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
         return nullptr;
     }
 
     return CloneFunctionObject(cx, fun, dynamicScope, fun->getAllocKind());
 }
 
 namespace JS {
 
@@ -3245,30 +3245,30 @@ JS_IsConstructor(JSFunction *fun)
 {
     return fun->isNativeConstructor() || fun->isInterpretedConstructor();
 }
 
 JS_PUBLIC_API(JSObject*)
 JS_BindCallable(JSContext *cx, HandleObject target, HandleObject newThis)
 {
     RootedValue thisArg(cx, ObjectValue(*newThis));
-    return js_fun_bind(cx, target, thisArg, nullptr, 0);
+    return fun_bind(cx, target, thisArg, nullptr, 0);
 }
 
 static bool
 js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     const JSFunctionSpec *fs = (JSFunctionSpec *)
         args.callee().as<JSFunction>().getExtendedSlot(0).toPrivate();
     MOZ_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0);
 
     if (argc < 1) {
-        js_ReportMissingArg(cx, args.calleev(), 0);
+        ReportMissingArg(cx, args.calleev(), 0);
         return false;
     }
 
     /*
      * Copy all actual (argc) arguments down over our |this| parameter, vp[1],
      * which is almost always the class constructor object, e.g. Array.  Then
      * call the corresponding prototype native method with our first argument
      * passed as |this|.
@@ -3419,17 +3419,17 @@ struct AutoLastFrameCheck
         MOZ_ASSERT(cx);
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     ~AutoLastFrameCheck() {
         if (cx->isExceptionPending() &&
             !JS_IsRunning(cx) &&
             (!cx->options().dontReportUncaught() && !cx->options().autoJSAPIOwnsErrorReporting())) {
-            js_ReportUncaughtException(cx);
+            ReportUncaughtException(cx);
         }
     }
 
   private:
     JSContext *cx;
     MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
@@ -3504,17 +3504,17 @@ class AutoFile
 bool
 AutoFile::open(JSContext *cx, const char *filename)
 {
     if (!filename || strcmp(filename, "-") == 0) {
         fp_ = stdin;
     } else {
         fp_ = fopen(filename, "r");
         if (!fp_) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
                                  filename, "No such file or directory");
             return false;
         }
     }
     return true;
 }
 
 JSObject * const JS::ReadOnlyCompileOptions::nullObjectPtr = nullptr;
@@ -4262,18 +4262,18 @@ JS_NewHelper(JSContext *cx, HandleObject
         return nullptr;
 
     if (!args.rval().isObject()) {
         /*
          * Although constructors may return primitives (via proxies), this
          * API is asking for an object, so we report an error.
          */
         JSAutoByteString bytes;
-        if (js_ValueToPrintable(cx, args.rval(), &bytes)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
+        if (ValueToPrintable(cx, args.rval(), &bytes)) {
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
                                  bytes.ptr());
         }
         return nullptr;
     }
 
     return &args.rval().toObject();
 }
 
@@ -4656,17 +4656,17 @@ JS_DecodeBytes(JSContext *cx, const char
     }
 
     size_t dstlen = *dstlenp;
 
     if (srclen > dstlen) {
         CopyAndInflateChars(dst, src, dstlen);
 
         AutoSuppressGC suppress(cx);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
         return false;
     }
 
     CopyAndInflateChars(dst, src, srclen);
     *dstlenp = srclen;
     return true;
 }
 
@@ -4838,17 +4838,17 @@ JS_Stringify(JSContext *cx, MutableHandl
              HandleValue space, JSONWriteCallback callback, void *data)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, replacer, space);
     StringBuffer sb(cx);
     if (!sb.ensureTwoByteChars())
         return false;
-    if (!js_Stringify(cx, vp, replacer, space, sb))
+    if (!Stringify(cx, vp, replacer, space, sb))
         return false;
     if (sb.empty() && !sb.append(cx->names().null))
         return false;
     return callback(sb.rawTwoByteBegin(), sb.length(), data);
 }
 
 JS_PUBLIC_API(bool)
 JS_ParseJSON(JSContext *cx, const char16_t *chars, uint32_t len, MutableHandleValue vp)
@@ -4892,17 +4892,17 @@ JS_ParseJSONWithReviver(JSContext *cx, H
 
 JS_PUBLIC_API(void)
 JS_ReportError(JSContext *cx, const char *format, ...)
 {
     va_list ap;
 
     AssertHeapIsIdle(cx);
     va_start(ap, format);
-    js_ReportErrorVA(cx, JSREPORT_ERROR, format, ap);
+    ReportErrorVA(cx, JSREPORT_ERROR, format, ap);
     va_end(ap);
 }
 
 JS_PUBLIC_API(void)
 JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback,
                      void *userRef, const unsigned errorNumber, ...)
 {
     va_list ap;
@@ -4912,98 +4912,98 @@ JS_ReportErrorNumber(JSContext *cx, JSEr
 }
 
 JS_PUBLIC_API(void)
 JS_ReportErrorNumberVA(JSContext *cx, JSErrorCallback errorCallback,
                        void *userRef, const unsigned errorNumber,
                        va_list ap)
 {
     AssertHeapIsIdle(cx);
-    js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
-                           errorNumber, ArgumentsAreASCII, ap);
+    ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
+                        errorNumber, ArgumentsAreASCII, ap);
 }
 
 JS_PUBLIC_API(void)
 JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback,
                        void *userRef, const unsigned errorNumber, ...)
 {
     va_list ap;
 
     AssertHeapIsIdle(cx);
     va_start(ap, errorNumber);
-    js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
-                           errorNumber, ArgumentsAreUnicode, ap);
+    ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
+                        errorNumber, ArgumentsAreUnicode, ap);
     va_end(ap);
 }
 
 JS_PUBLIC_API(void)
 JS_ReportErrorNumberUCArray(JSContext *cx, JSErrorCallback errorCallback,
                             void *userRef, const unsigned errorNumber,
                             const char16_t **args)
 {
     AssertHeapIsIdle(cx);
-    js_ReportErrorNumberUCArray(cx, JSREPORT_ERROR, errorCallback, userRef,
-                                errorNumber, args);
+    ReportErrorNumberUCArray(cx, JSREPORT_ERROR, errorCallback, userRef,
+                             errorNumber, args);
 }
 
 JS_PUBLIC_API(bool)
 JS_ReportWarning(JSContext *cx, const char *format, ...)
 {
     va_list ap;
     bool ok;
 
     AssertHeapIsIdle(cx);
     va_start(ap, format);
-    ok = js_ReportErrorVA(cx, JSREPORT_WARNING, format, ap);
+    ok = ReportErrorVA(cx, JSREPORT_WARNING, format, ap);
     va_end(ap);
     return ok;
 }
 
 JS_PUBLIC_API(bool)
 JS_ReportErrorFlagsAndNumber(JSContext *cx, unsigned flags,
                              JSErrorCallback errorCallback, void *userRef,
                              const unsigned errorNumber, ...)
 {
     va_list ap;
     bool ok;
 
     AssertHeapIsIdle(cx);
     va_start(ap, errorNumber);
-    ok = js_ReportErrorNumberVA(cx, flags, errorCallback, userRef,
-                                errorNumber, ArgumentsAreASCII, ap);
+    ok = ReportErrorNumberVA(cx, flags, errorCallback, userRef,
+                             errorNumber, ArgumentsAreASCII, ap);
     va_end(ap);
     return ok;
 }
 
 JS_PUBLIC_API(bool)
 JS_ReportErrorFlagsAndNumberUC(JSContext *cx, unsigned flags,
                                JSErrorCallback errorCallback, void *userRef,
                                const unsigned errorNumber, ...)
 {
     va_list ap;
     bool ok;
 
     AssertHeapIsIdle(cx);
     va_start(ap, errorNumber);
-    ok = js_ReportErrorNumberVA(cx, flags, errorCallback, userRef,
-                                errorNumber, ArgumentsAreUnicode, ap);
+    ok = ReportErrorNumberVA(cx, flags, errorCallback, userRef,
+                             errorNumber, ArgumentsAreUnicode, ap);
     va_end(ap);
     return ok;
 }
 
 JS_PUBLIC_API(void)
 JS_ReportOutOfMemory(JSContext *cx)
 {
-    js_ReportOutOfMemory(cx);
+    ReportOutOfMemory(cx);
 }
 
 JS_PUBLIC_API(void)
 JS_ReportAllocationOverflow(JSContext *cx)
 {
-    js_ReportAllocationOverflow(cx);
+    ReportAllocationOverflow(cx);
 }
 
 JS_PUBLIC_API(JSErrorReporter)
 JS_GetErrorReporter(JSRuntime *rt)
 {
     return rt->errorReporter;
 }
 
@@ -5022,25 +5022,25 @@ JS_SetErrorReporter(JSRuntime *rt, JSErr
 /*
  * Dates.
  */
 JS_PUBLIC_API(JSObject *)
 JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
-    return js_NewDateObject(cx, year, mon, mday, hour, min, sec);
+    return NewDateObject(cx, year, mon, mday, hour, min, sec);
 }
 
 JS_PUBLIC_API(JSObject *)
 JS_NewDateObjectMsec(JSContext *cx, double msec)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
-    return js_NewDateObjectMsec(cx, msec);
+    return NewDateObjectMsec(cx, msec);
 }
 
 JS_PUBLIC_API(bool)
 JS_ObjectIsDate(JSContext *cx, HandleObject obj)
 {
     assertSameCompartment(cx, obj);
     return ObjectClassIs(obj, ESClass_Date, cx);
 }
@@ -5274,17 +5274,17 @@ JS_ClearPendingException(JSContext *cx)
 
 JS_PUBLIC_API(bool)
 JS_ReportPendingException(JSContext *cx)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
 
     // This can only fail due to oom.
-    bool ok = js_ReportUncaughtException(cx);
+    bool ok = ReportUncaughtException(cx);
     MOZ_ASSERT(!cx->isExceptionPending());
     return ok;
 }
 
 JS::AutoSaveExceptionState::AutoSaveExceptionState(JSContext *cx)
   : context(cx),
     wasPropagatingForcedReturn(cx->propagatingForcedReturn_),
     wasOverRecursed(cx->overRecursed_),
@@ -5368,17 +5368,17 @@ JS_DropExceptionState(JSContext *cx, JSE
 }
 
 JS_PUBLIC_API(JSErrorReport *)
 JS_ErrorFromException(JSContext *cx, HandleObject obj)
 {
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj);
-    return js_ErrorFromException(cx, obj);
+    return ErrorFromException(cx, obj);
 }
 
 JS_PUBLIC_API(bool)
 JS_ThrowStopIteration(JSContext *cx)
 {
     AssertHeapIsIdle(cx);
     return ThrowStopIteration(cx);
 }
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -335,17 +335,17 @@ SetArrayElement(JSContext *cx, HandleObj
         Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
         /* Predicted/prefetched code should favor the remains-dense case. */
         NativeObject::EnsureDenseResult result = NativeObject::ED_SPARSE;
         do {
             if (index > uint32_t(-1))
                 break;
             uint32_t idx = uint32_t(index);
             if (idx >= arr->length() && !arr->lengthIsWritable()) {
-                JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+                JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
                                              JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
                 return false;
             }
             result = arr->ensureDenseElements(cx, idx, 1);
             if (result != NativeObject::ED_OK)
                 break;
             if (idx >= arr->length())
                 arr->setLengthInt32(idx + 1);
@@ -494,17 +494,17 @@ js::CanonicalizeArrayLengthValue(JSConte
         return false;
 
     if (!ToNumber(cx, v, &d))
         return false;
 
     if (d == *newLen)
         return true;
 
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
     return false;
 }
 
 /* ES6 20130308 draft 8.4.2.4 ArraySetLength */
 bool
 js::ArraySetLength(JSContext *cx, Handle<ArrayObject*> arr, HandleId id,
                    unsigned attrs, HandleValue value, bool setterIsStrict)
 {
@@ -548,17 +548,17 @@ js::ArraySetLength(JSContext *cx, Handle
     uint32_t oldLen = arr->length();
 
     /* Steps 8-9 for arrays with non-writable length. */
     if (!lengthIsWritable) {
         if (newLen == oldLen)
             return true;
 
         if (setterIsStrict) {
-            return JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+            return JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
                                                 JSMSG_CANT_REDEFINE_ARRAY_LENGTH);
         }
 
         return JSObject::reportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
     }
 
     /* Step 8. */
     bool succeeded = true;
@@ -654,17 +654,17 @@ js::ArraySetLength(JSContext *cx, Handle
                 if (!GetPropertyKeys(cx, arr, JSITER_OWNONLY | JSITER_HIDDEN, &props))
                     return false;
 
                 for (size_t i = 0; i < props.length(); i++) {
                     if (!CheckForInterrupt(cx))
                         return false;
 
                     uint32_t index;
-                    if (!js_IdIsIndex(props[i], &index))
+                    if (!IdIsIndex(props[i], &index))
                         continue;
 
                     if (index >= newLen && index < oldLen) {
                         if (!indexes.append(index))
                             return false;
                     }
                 }
             }
@@ -778,27 +778,27 @@ js::WouldDefinePastNonwritableLength(Exc
         return true;
 
     JSContext *ncx = cx->asJSContext();
 
     if (!strict && !ncx->compartment()->options().extraWarnings(ncx))
         return true;
 
     // XXX include the index and maybe array length in the error message
-    return JS_ReportErrorFlagsAndNumber(ncx, flags, js_GetErrorMessage, nullptr,
+    return JS_ReportErrorFlagsAndNumber(ncx, flags, GetErrorMessage, nullptr,
                                         JSMSG_CANT_DEFINE_PAST_ARRAY_LENGTH);
 }
 
 static bool
 array_addProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
 {
     Rooted<ArrayObject*> arr(cx, &obj->as<ArrayObject>());
 
     uint32_t index;
-    if (!js_IdIsIndex(id, &index))
+    if (!IdIsIndex(id, &index))
         return true;
 
     uint32_t length = arr->length();
     if (index >= length) {
         MOZ_ASSERT(arr->lengthIsWritable(),
                    "how'd this element get added if length is non-writable?");
         arr->setLength(cx, index + 1);
     }
@@ -1068,17 +1068,17 @@ js::ArrayJoin(JSContext *cx, HandleObjec
     if (sepstr->hasTwoByteChars() && !sb.ensureTwoByteChars())
         return nullptr;
 
     // The separator will be added |length - 1| times, reserve space for that
     // so that we don't have to unnecessarily grow the buffer.
     size_t seplen = sepstr->length();
     CheckedInt<uint32_t> res = CheckedInt<uint32_t>(seplen) * (length - 1);
     if (length > 0 && !res.isValid()) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return nullptr;
     }
 
     if (length > 0 && !sb.reserve(res.value()))
         return nullptr;
 
     // Various optimized versions of steps 7-10.
     if (seplen == 0) {
@@ -1868,17 +1868,17 @@ js::array_sort(JSContext *cx, unsigned a
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedValue fvalRoot(cx);
     Value &fval = fvalRoot.get();
 
     if (args.hasDefined(0)) {
         if (args[0].isPrimitive()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_SORT_ARG);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_SORT_ARG);
             return false;
         }
         fval = args[0];     /* non-default compare function */
     } else {
         fval.setNull();
     }
 
     RootedObject obj(cx, ToObject(cx, args.thisv()));
@@ -1897,17 +1897,17 @@ js::array_sort(JSContext *cx, unsigned a
     /*
      * We need a temporary array of 2 * len Value to hold the array elements
      * and the scratch space for merge sort. Check that its size does not
      * overflow size_t, which would allow for indexing beyond the end of the
      * malloc'd vector.
      */
 #if JS_BITS_PER_WORD == 32
     if (size_t(len) > size_t(-1) / (2 * sizeof(Value))) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return false;
     }
 #endif
 
     /*
      * Initialize vec as a root. We will clear elements of vec one by
      * one while increasing the rooted amount of vec when we know that the
      * property at the corresponding index exists and its value must be rooted.
@@ -2961,17 +2961,17 @@ array_filter(JSContext *cx, unsigned arg
 
     /* Step 2-3. */
     uint32_t len;
     if (!GetLengthProperty(cx, obj, &len))
         return false;
 
     /* Step 4. */
     if (args.length() == 0) {
-        js_ReportMissingArg(cx, args.calleev(), 0);
+        ReportMissingArg(cx, args.calleev(), 0);
         return false;
     }
     RootedObject callable(cx, ValueToCallable(cx, args[0], args.length() - 1));
     if (!callable)
         return false;
 
     /* Step 5. */
     RootedValue thisv(cx, args.length() >= 2 ? args[1] : UndefinedValue());
@@ -3049,17 +3049,17 @@ static bool
 IsArrayConstructor(const Value &v)
 {
     // This must only return true if v is *the* Array constructor for the
     // current compartment; we rely on the fact that any other Array
     // constructor would be represented as a wrapper.
     return v.isObject() &&
            v.toObject().is<JSFunction>() &&
            v.toObject().as<JSFunction>().isNative() &&
-           v.toObject().as<JSFunction>().native() == js_Array;
+           v.toObject().as<JSFunction>().native() == ArrayConstructor;
 }
 
 static bool
 ArrayFromCallArgs(JSContext *cx, HandleObjectGroup group, CallArgs &args)
 {
     if (!InitArrayTypes(cx, group, args.array(), args.length()))
         return false;
     JSObject *obj = (args.length() == 0)
@@ -3179,39 +3179,39 @@ static const JSFunctionSpec array_static
     JS_SELF_HOSTED_FN("from",        "ArrayFrom", 3,0),
     JS_FN("of",                 array_of,           0,0),
 
     JS_FS_END
 };
 
 /* ES5 15.4.2 */
 bool
-js_Array(JSContext *cx, unsigned argc, Value *vp)
+js::ArrayConstructor(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedObjectGroup group(cx, ObjectGroup::callingAllocationSiteGroup(cx, JSProto_Array));
     if (!group)
         return false;
 
     if (args.length() != 1 || !args[0].isNumber())
         return ArrayFromCallArgs(cx, group, args);
 
     uint32_t length;
     if (args[0].isInt32()) {
         int32_t i = args[0].toInt32();
         if (i < 0) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
             return false;
         }
         length = uint32_t(i);
     } else {
         double d = args[0].toDouble();
         length = ToUint32(d);
         if (d != double(length)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
             return false;
         }
     }
 
     /*
      * Allocate up to |EagerAllocationMaxLength| dense elements eagerly, to
      * avoid reallocating elements when filling the array.
      */
@@ -3225,17 +3225,17 @@ js_Array(JSContext *cx, unsigned argc, V
     args.rval().setObject(*obj);
     return true;
 }
 
 ArrayObject *
 js::ArrayConstructorOneArg(JSContext *cx, HandleObjectGroup group, int32_t lengthInt)
 {
     if (lengthInt < 0) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_ARRAY_LENGTH);
         return nullptr;
     }
 
     uint32_t length = uint32_t(lengthInt);
     AllocatingBehaviour allocating = (length <= ArrayObject::EagerAllocationMaxLength)
                                    ? NewArray_FullyAllocating
                                    : NewArray_PartlyAllocating;
     return NewDenseArray(cx, length, group, allocating);
@@ -3296,17 +3296,17 @@ const Class ArrayObject::class_ = {
     nullptr, /* resolve */
     nullptr, /* convert */
     nullptr, /* finalize */
     nullptr, /* call */
     nullptr, /* hasInstance */
     nullptr, /* construct */
     nullptr, /* trace */
     {
-        GenericCreateConstructor<js_Array, 1, JSFunction::FinalizeKind>,
+        GenericCreateConstructor<ArrayConstructor, 1, JSFunction::FinalizeKind>,
         CreateArrayPrototype,
         array_static_methods,
         array_methods
     }
 };
 
 /*
  * Array allocation functions.
@@ -3571,17 +3571,17 @@ js::NewDenseCopyOnWriteArray(JSContext *
         return nullptr;
 
     probes::CreateObject(cx, arr);
     return arr;
 }
 
 #ifdef DEBUG
 bool
-js_ArrayInfo(JSContext *cx, unsigned argc, Value *vp)
+js::ArrayInfo(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JSObject *obj;
 
     for (unsigned i = 0; i < args.length(); i++) {
         RootedValue arg(cx, args[i]);
 
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, NullPtr());
--- a/js/src/jsarray.h
+++ b/js/src/jsarray.h
@@ -10,41 +10,35 @@
 #define jsarray_h
 
 #include "jsobj.h"
 #include "jspubtd.h"
 
 namespace js {
 /* 2^32-2, inclusive */
 const uint32_t MAX_ARRAY_INDEX = 4294967294u;
-}
 
 inline bool
-js_IdIsIndex(jsid id, uint32_t *indexp)
+IdIsIndex(jsid id, uint32_t *indexp)
 {
     if (JSID_IS_INT(id)) {
         int32_t i = JSID_TO_INT(id);
         MOZ_ASSERT(i >= 0);
         *indexp = (uint32_t)i;
         return true;
     }
 
     if (MOZ_UNLIKELY(!JSID_IS_STRING(id)))
         return false;
 
     return js::StringIsArrayIndex(JSID_TO_ATOM(id), indexp);
 }
 
 extern JSObject *
-js_InitArrayClass(JSContext *cx, js::HandleObject obj);
-
-extern bool
-js_InitContextBusyArrayTable(JSContext *cx);
-
-namespace js {
+InitArrayClass(JSContext *cx, js::HandleObject obj);
 
 class ArrayObject;
 
 /* Create a dense array with no capacity allocated, length set to 0. */
 extern ArrayObject * JS_FASTCALL
 NewDenseEmptyArray(JSContext *cx, HandleObject proto = NullPtr(),
                    NewObjectKind newKind = GenericObject);
 
@@ -126,17 +120,17 @@ SetLengthProperty(JSContext *cx, HandleO
 
 extern bool
 ObjectMayHaveExtraIndexedProperties(JSObject *obj);
 
 /*
  * Copy 'length' elements from aobj to vp.
  *
  * This function assumes 'length' is effectively the result of calling
- * js_GetLengthProperty on aobj. vp must point to rooted memory.
+ * GetLengthProperty on aobj. vp must point to rooted memory.
  */
 extern bool
 GetElements(JSContext *cx, HandleObject aobj, uint32_t length, js::Value *vp);
 
 /* Natives exposed for optimization by the interpreter and JITs. */
 
 extern bool
 array_sort(JSContext *cx, unsigned argc, js::Value *vp);
@@ -190,20 +184,20 @@ array_slice(JSContext *cx, unsigned argc
  * sparse, which requires that the array be completely filled.)
  */
 extern bool
 NewbornArrayPush(JSContext *cx, HandleObject obj, const Value &v);
 
 extern ArrayObject *
 ArrayConstructorOneArg(JSContext *cx, HandleObjectGroup group, int32_t lengthInt);
 
-} /* namespace js */
-
 #ifdef DEBUG
 extern bool
-js_ArrayInfo(JSContext *cx, unsigned argc, js::Value *vp);
+ArrayInfo(JSContext *cx, unsigned argc, Value *vp);
 #endif
 
 /* Array constructor native. Exposed only so the JIT can know its address. */
-bool
-js_Array(JSContext *cx, unsigned argc, js::Value *vp);
+extern bool
+ArrayConstructor(JSContext *cx, unsigned argc, Value *vp);
+
+} /* namespace js */
 
 #endif /* jsarray_h */
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -34,17 +34,17 @@ using namespace js::gc;
 
 using mozilla::ArrayEnd;
 using mozilla::ArrayLength;
 using mozilla::RangedPtr;
 
 const char *
 js::AtomToPrintableString(ExclusiveContext *cx, JSAtom *atom, JSAutoByteString *bytes)
 {
-    JSString *str = js_QuoteString(cx, atom, 0);
+    JSString *str = QuoteString(cx, atom, 0);
     if (!str)
         return nullptr;
     return bytes->encodeLatin1(cx, str);
 }
 
 #define DEFINE_PROTO_STRING(name,code,init,clasp) const char js_##name##_str[] = #name;
 JS_FOR_EACH_PROTOTYPE(DEFINE_PROTO_STRING)
 #undef DEFINE_PROTO_STRING
@@ -158,17 +158,17 @@ JSRuntime::initializeAtoms(JSContext *cx
     if (!wellKnownSymbols)
         return false;
 
     ImmutablePropertyNamePtr *descriptions = commonNames->wellKnownSymbolDescriptions();
     ImmutableSymbolPtr *symbols = reinterpret_cast<ImmutableSymbolPtr *>(wellKnownSymbols);
     for (size_t i = 0; i < JS::WellKnownSymbolLimit; i++) {
         JS::Symbol *symbol = JS::Symbol::new_(cx, JS::SymbolCode(i), descriptions[i]);
         if (!symbol) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
         symbols[i].init(symbol);
     }
 
     return true;
 }
 
@@ -347,27 +347,27 @@ AtomizeAndCopyChars(ExclusiveContext *cx
 
     AutoCompartment ac(cx, cx->atomsCompartment());
 
     JSFlatString *flat = NewStringCopyN<NoGC>(cx, tbchars, length);
     if (!flat) {
         // Grudgingly forgo last-ditch GC. The alternative would be to release
         // the lock, manually GC here, and retry from the top. If you fix this,
         // please also fix or comment the similar case in Symbol::new_.
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     JSAtom *atom = flat->morphAtomizedStringIntoAtom();
 
     // We have held the lock since looking up p, and the operations we've done
     // since then can't GC; therefore the atoms table has not been modified and
     // p is still valid.
     if (!atoms.add(p, AtomStateEntry(atom, bool(ib)))) {
-        js_ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
+        ReportOutOfMemory(cx); /* SystemAllocPolicy does not report OOM. */
         return nullptr;
     }
 
     return atom;
 }
 
 template JSAtom *
 AtomizeAndCopyChars(ExclusiveContext *cx, const char16_t *tbchars, size_t length, InternBehavior ib);
--- a/js/src/jsbool.cpp
+++ b/js/src/jsbool.cpp
@@ -65,17 +65,17 @@ bool_toSource(JSContext *cx, unsigned ar
 
 MOZ_ALWAYS_INLINE bool
 bool_toString_impl(JSContext *cx, CallArgs args)
 {
     HandleValue thisv = args.thisv();
     MOZ_ASSERT(IsBoolean(thisv));
 
     bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as<BooleanObject>().unbox();
-    args.rval().setString(js_BooleanToString(cx, b));
+    args.rval().setString(BooleanToString(cx, b));
     return true;
 }
 
 static bool
 bool_toString(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsBoolean, bool_toString_impl>(cx, args);
@@ -122,17 +122,17 @@ Boolean(JSContext *cx, unsigned argc, Va
         args.rval().setObject(*obj);
     } else {
         args.rval().setBoolean(b);
     }
     return true;
 }
 
 JSObject *
-js_InitBooleanClass(JSContext *cx, HandleObject obj)
+js::InitBooleanClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->isNative());
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     Rooted<BooleanObject*> booleanProto(cx, global->createBlankPrototype<BooleanObject>(cx));
     if (!booleanProto)
         return nullptr;
@@ -150,17 +150,17 @@ js_InitBooleanClass(JSContext *cx, Handl
 
     if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_Boolean, ctor, booleanProto))
         return nullptr;
 
     return booleanProto;
 }
 
 JSString *
-js_BooleanToString(ExclusiveContext *cx, bool b)
+js::BooleanToString(ExclusiveContext *cx, bool b)
 {
     return b ? cx->names().true_ : cx->names().false_;
 }
 
 JS_PUBLIC_API(bool)
 js::ToBooleanSlow(HandleValue v)
 {
     if (v.isString())
--- a/js/src/jsbool.h
+++ b/js/src/jsbool.h
@@ -8,15 +8,19 @@
 #define jsbool_h
 
 /*
  * JS boolean interface.
  */
 
 #include "NamespaceImports.h"
 
+namespace js {
+
 extern JSObject *
-js_InitBooleanClass(JSContext *cx, js::HandleObject obj);
+InitBooleanClass(JSContext *cx, js::HandleObject obj);
 
 extern JSString *
-js_BooleanToString(js::ExclusiveContext *cx, bool b);
+BooleanToString(js::ExclusiveContext *cx, bool b);
+
+}
 
 #endif /* jsbool_h */
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -214,34 +214,32 @@ ReportError(JSContext *cx, const char *m
 {
     /*
      * Check the error report, and set a JavaScript-catchable exception
      * if the error is defined to have an associated exception.  If an
      * exception is thrown, then the JSREPORT_EXCEPTION flag will be set
      * on the error report, and exception-aware hosts should ignore it.
      */
     MOZ_ASSERT(reportp);
-    if ((!callback || callback == js_GetErrorMessage) &&
+    if ((!callback || callback == GetErrorMessage) &&
         reportp->errorNumber == JSMSG_UNCAUGHT_EXCEPTION)
     {
         reportp->flags |= JSREPORT_EXCEPTION;
     }
 
     if (cx->options().autoJSAPIOwnsErrorReporting() || JS_IsRunning(cx)) {
-        if (js_ErrorToException(cx, message, reportp, callback, userRef)) {
+        if (ErrorToException(cx, message, reportp, callback, userRef))
             return;
-        }
     }
 
     /*
      * Call the error reporter only if an exception wasn't raised.
      */
-    if (message) {
+    if (message)
         CallErrorReporter(cx, message, reportp);
-    }
 }
 
 /*
  * The given JSErrorReport object have been zeroed and must not outlive
  * cx->fp() (otherwise owned fields may become invalid).
  */
 static void
 PopulateReportBlame(JSContext *cx, JSErrorReport *report)
@@ -260,29 +258,29 @@ PopulateReportBlame(JSContext *cx, JSErr
 }
 
 /*
  * Since memory has been exhausted, avoid the normal error-handling path which
  * allocates an error object, report and callstack. If code is running, simply
  * throw the static atom "out of memory". If code is not running, call the
  * error reporter directly.
  *
- * Furthermore, callers of js_ReportOutOfMemory (viz., malloc) assume a GC does
+ * Furthermore, callers of ReportOutOfMemory (viz., malloc) assume a GC does
  * not occur, so GC must be avoided or suppressed.
  */
 void
-js_ReportOutOfMemory(ExclusiveContext *cxArg)
+js::ReportOutOfMemory(ExclusiveContext *cxArg)
 {
 #ifdef JS_MORE_DETERMINISTIC
     /*
      * OOMs are non-deterministic, especially across different execution modes
      * (e.g. interpreter vs JIT). In more-deterministic builds, print to stderr
      * so that the fuzzers can detect this.
      */
-    fprintf(stderr, "js_ReportOutOfMemory called\n");
+    fprintf(stderr, "ReportOutOfMemory called\n");
 #endif
 
     if (!cxArg->isJSContext())
         return;
 
     JSContext *cx = cxArg->asJSContext();
     cx->runtime()->hadOutOfMemory = true;
 
@@ -293,17 +291,17 @@ js_ReportOutOfMemory(ExclusiveContext *c
     }
 
     if (JS_IsRunning(cx)) {
         cx->setPendingException(StringValue(cx->names().outOfMemory));
         return;
     }
 
     /* Get the message for this error, but we don't expand any arguments. */
-    const JSErrorFormatString *efs = js_GetErrorMessage(nullptr, JSMSG_OUT_OF_MEMORY);
+    const JSErrorFormatString *efs = GetErrorMessage(nullptr, JSMSG_OUT_OF_MEMORY);
     const char *msg = efs ? efs->format : "Out of memory";
 
     /* Fill out the report, but don't do anything that requires allocation. */
     JSErrorReport report;
     report.flags = JSREPORT_ERROR;
     report.errorNumber = JSMSG_OUT_OF_MEMORY;
     PopulateReportBlame(cx, &report);
 
@@ -322,56 +320,56 @@ js_ReportOutOfMemory(ExclusiveContext *c
      * When JS code is running, we set the pending exception to an atom, which
      * does not need wrapping. If no JS code is running, no exception should be
      * set at all.
      */
     MOZ_ASSERT(!cx->isExceptionPending());
 }
 
 JS_FRIEND_API(void)
-js_ReportOverRecursed(JSContext *maybecx)
+js::ReportOverRecursed(JSContext *maybecx)
 {
 #ifdef JS_MORE_DETERMINISTIC
     /*
      * We cannot make stack depth deterministic across different
      * implementations (e.g. JIT vs. interpreter will differ in
      * their maximum stack depth).
      * However, we can detect externally when we hit the maximum
      * stack depth which is useful for external testing programs
      * like fuzzers.
      */
-    fprintf(stderr, "js_ReportOverRecursed called\n");
+    fprintf(stderr, "ReportOverRecursed called\n");
 #endif
     if (maybecx) {
-        JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr, JSMSG_OVER_RECURSED);
+        JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr, JSMSG_OVER_RECURSED);
         maybecx->overRecursed_ = true;
     }
 }
 
 void
-js_ReportOverRecursed(ExclusiveContext *cx)
+js::ReportOverRecursed(ExclusiveContext *cx)
 {
     if (cx->isJSContext())
-        js_ReportOverRecursed(cx->asJSContext());
+        ReportOverRecursed(cx->asJSContext());
     else
         cx->addPendingOverRecursed();
 }
 
 void
-js_ReportAllocationOverflow(ExclusiveContext *cxArg)
+js::ReportAllocationOverflow(ExclusiveContext *cxArg)
 {
     if (!cxArg)
         return;
 
     if (!cxArg->isJSContext())
         return;
     JSContext *cx = cxArg->asJSContext();
 
     AutoSuppressGC suppressGC(cx);
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_ALLOC_OVERFLOW);
 }
 
 /*
  * Given flags and the state of cx, decide whether we should report an
  * error, a warning, or just continue execution normally.  Return
  * true if we should continue normally, without reporting anything;
  * otherwise, adjust *flags as appropriate and return false.
  */
@@ -401,17 +399,17 @@ checkReportFlags(JSContext *cx, unsigned
     /* Warnings become errors when JSOPTION_WERROR is set. */
     if (JSREPORT_IS_WARNING(*flags) && cx->runtime()->options().werror())
         *flags &= ~JSREPORT_WARNING;
 
     return false;
 }
 
 bool
-js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap)
+js::ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap)
 {
     char *message;
     char16_t *ucmessage;
     size_t messagelen;
     JSErrorReport report;
     bool warning;
 
     if (checkReportFlags(cx, &flags))
@@ -544,30 +542,30 @@ js::PrintError(JSContext *cx, FILE *file
  * The format string addressed by the error number may contain operands
  * identified by the format {N}, where N is a decimal digit. Each of these
  * is to be replaced by the Nth argument from the va_list. The complete
  * message is placed into reportp->ucmessage converted to a JSString.
  *
  * Returns true if the expansion succeeds (can fail if out of memory).
  */
 bool
-js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
-                        void *userRef, const unsigned errorNumber,
-                        char **messagep, JSErrorReport *reportp,
-                        ErrorArgumentsType argumentsType, va_list ap)
+js::ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
+                         void *userRef, const unsigned errorNumber,
+                         char **messagep, JSErrorReport *reportp,
+                         ErrorArgumentsType argumentsType, va_list ap)
 {
     const JSErrorFormatString *efs;
     int i;
     int argCount;
     bool messageArgsPassed = !!reportp->messageArgs;
 
     *messagep = nullptr;
 
     if (!callback)
-        callback = js_GetErrorMessage;
+        callback = GetErrorMessage;
 
     {
         AutoSuppressGC suppressGC(cx);
         efs = callback(userRef, errorNumber);
     }
 
     if (efs) {
         reportp->exnType = efs->exnType;
@@ -709,76 +707,76 @@ error:
     if (*messagep) {
         js_free((void *)*messagep);
         *messagep = nullptr;
     }
     return false;
 }
 
 bool
-js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback,
-                       void *userRef, const unsigned errorNumber,
-                       ErrorArgumentsType argumentsType, va_list ap)
+js::ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback,
+                        void *userRef, const unsigned errorNumber,
+                        ErrorArgumentsType argumentsType, va_list ap)
 {
     JSErrorReport report;
     char *message;
     bool warning;
 
     if (checkReportFlags(cx, &flags))
         return true;
     warning = JSREPORT_IS_WARNING(flags);
 
     report.flags = flags;
     report.errorNumber = errorNumber;
     PopulateReportBlame(cx, &report);
 
-    if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
-                                 &message, &report, argumentsType, ap)) {
+    if (!ExpandErrorArguments(cx, callback, userRef, errorNumber,
+                              &message, &report, argumentsType, ap)) {
         return false;
     }
 
     ReportError(cx, message, &report, callback, userRef);
 
     js_free(message);
     if (report.messageArgs) {
         /*
-         * js_ExpandErrorArguments owns its messageArgs only if it had to
+         * ExpandErrorArguments owns its messageArgs only if it had to
          * inflate the arguments (from regular |char *|s).
          */
         if (argumentsType == ArgumentsAreASCII) {
             int i = 0;
             while (report.messageArgs[i])
                 js_free((void *)report.messageArgs[i++]);
         }
         js_free((void *)report.messageArgs);
     }
     js_free((void *)report.ucmessage);
 
     return warning;
 }
 
 bool
-js_ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callback,
-                            void *userRef, const unsigned errorNumber,
-                            const char16_t **args)
+js::ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callback,
+                             void *userRef, const unsigned errorNumber,
+                             const char16_t **args)
 {
     if (checkReportFlags(cx, &flags))
         return true;
     bool warning = JSREPORT_IS_WARNING(flags);
 
     JSErrorReport report;
     report.flags = flags;
     report.errorNumber = errorNumber;
     PopulateReportBlame(cx, &report);
     report.messageArgs = args;
 
     char *message;
     va_list dummy;
-    if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
-                                 &message, &report, ArgumentsAreUnicode, dummy)) {
+    if (!ExpandErrorArguments(cx, callback, userRef, errorNumber,
+                              &message, &report, ArgumentsAreUnicode, dummy)) {
         return false;
     }
 
     ReportError(cx, message, &report, callback, userRef);
 
     js_free(message);
     js_free((void *)report.ucmessage);
 
@@ -791,106 +789,106 @@ js::CallErrorReporter(JSContext *cx, con
     MOZ_ASSERT(message);
     MOZ_ASSERT(reportp);
 
     if (JSErrorReporter onError = cx->runtime()->errorReporter)
         onError(cx, message, reportp);
 }
 
 void
-js_ReportIsNotDefined(JSContext *cx, const char *name)
+js::ReportIsNotDefined(JSContext *cx, const char *name)
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, name);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_DEFINED, name);
 }
 
 bool
-js_ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v,
-                           HandleString fallback)
+js::ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v,
+                            HandleString fallback)
 {
     char *bytes;
     bool ok;
 
     bytes = DecompileValueGenerator(cx, spindex, v, fallback);
     if (!bytes)
         return false;
 
     if (strcmp(bytes, js_undefined_str) == 0 ||
         strcmp(bytes, js_null_str) == 0) {
         ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
-                                          js_GetErrorMessage, nullptr,
+                                          GetErrorMessage, nullptr,
                                           JSMSG_NO_PROPERTIES, bytes,
                                           nullptr, nullptr);
     } else if (v.isUndefined()) {
         ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
-                                          js_GetErrorMessage, nullptr,
+                                          GetErrorMessage, nullptr,
                                           JSMSG_UNEXPECTED_TYPE, bytes,
                                           js_undefined_str, nullptr);
     } else {
         MOZ_ASSERT(v.isNull());
         ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
-                                          js_GetErrorMessage, nullptr,
+                                          GetErrorMessage, nullptr,
                                           JSMSG_UNEXPECTED_TYPE, bytes,
                                           js_null_str, nullptr);
     }
 
     js_free(bytes);
     return ok;
 }
 
 void
-js_ReportMissingArg(JSContext *cx, HandleValue v, unsigned arg)
+js::ReportMissingArg(JSContext *cx, HandleValue v, unsigned arg)
 {
     char argbuf[11];
     char *bytes;
     RootedAtom atom(cx);
 
     JS_snprintf(argbuf, sizeof argbuf, "%u", arg);
     bytes = nullptr;
     if (IsFunctionObject(v)) {
         atom = v.toObject().as<JSFunction>().atom();
         bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK,
                                         v, atom);
         if (!bytes)
             return;
     }
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                          JSMSG_MISSING_FUN_ARG, argbuf,
                          bytes ? bytes : "");
     js_free(bytes);
 }
 
 bool
-js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumber,
-                         int spindex, HandleValue v, HandleString fallback,
-                         const char *arg1, const char *arg2)
+js::ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumber,
+                          int spindex, HandleValue v, HandleString fallback,
+                          const char *arg1, const char *arg2)
 {
     char *bytes;
     bool ok;
 
     MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1);
     MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3);
     bytes = DecompileValueGenerator(cx, spindex, v, fallback);
     if (!bytes)
         return false;
 
-    ok = JS_ReportErrorFlagsAndNumber(cx, flags, js_GetErrorMessage,
+    ok = JS_ReportErrorFlagsAndNumber(cx, flags, GetErrorMessage,
                                       nullptr, errorNumber, bytes, arg1, arg2);
     js_free(bytes);
     return ok;
 }
 
 const JSErrorFormatString js_ErrorFormatString[JSErr_Limit] = {
 #define MSG_DEF(name, count, exception, format) \
     { format, count, exception } ,
 #include "js.msg"
 #undef MSG_DEF
 };
 
 JS_FRIEND_API(const JSErrorFormatString *)
-js_GetErrorMessage(void *userRef, const unsigned errorNumber)
+js::GetErrorMessage(void *userRef, const unsigned errorNumber)
 {
     if (errorNumber > 0 && errorNumber < JSErr_Limit)
         return &js_ErrorFormatString[errorNumber];
     return nullptr;
 }
 
 ExclusiveContext::ExclusiveContext(JSRuntime *rt, PerThreadData *pt, ContextKind kind)
   : ContextFriendFields(rt),
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -172,17 +172,17 @@ class ExclusiveContext : public ContextF
     void recoverFromOutOfMemory();
 
     inline void updateMallocCounter(size_t nbytes) {
         // Note: this is racy.
         runtime_->updateMallocCounter(zone_, nbytes);
     }
 
     void reportAllocationOverflow() {
-        js_ReportAllocationOverflow(this);
+        js::ReportAllocationOverflow(this);
     }
 
     // Accessors for immutable runtime data.
     JSAtomState &names() { return *runtime_->commonNames; }
     StaticStrings &staticStrings() { return *runtime_->staticStrings; }
     bool isPermanentAtomsInitialized() { return !!runtime_->permanentAtoms; }
     FrozenAtomSet &permanentAtoms() { return *runtime_->permanentAtoms; }
     WellKnownSymbols &wellKnownSymbols() { return *runtime_->wellKnownSymbols; }
@@ -294,28 +294,28 @@ struct JSContext : public js::ExclusiveC
 
     static size_t offsetOfRuntime() {
         return offsetof(JSContext, runtime_);
     }
 
     friend class js::ExclusiveContext;
     friend class JS::AutoSaveExceptionState;
     friend class js::jit::DebugModeOSRVolatileJitFrameIterator;
-    friend void js_ReportOverRecursed(JSContext *);
+    friend void js::ReportOverRecursed(JSContext *);
 
   private:
     /* Exception state -- the exception member is a GC root by definition. */
     bool                throwing;            /* is there a pending exception? */
     js::Value           unwrappedException_; /* most-recently-thrown exception */
 
     /* Per-context options. */
     JS::ContextOptions  options_;
 
     // True if the exception currently being thrown is by result of
-    // js_ReportOverRecursed. See Debugger::slowPathOnExceptionUnwind.
+    // ReportOverRecursed. See Debugger::slowPathOnExceptionUnwind.
     bool                overRecursed_;
 
     // True if propagating a forced return from an interrupt handler during
     // debug mode.
     bool                propagatingForcedReturn_;
 
     // A stack of live iterators that need to be updated in case of debug mode
     // OSR.
@@ -560,40 +560,36 @@ enum ErrorArgumentsType {
  * Loads and returns a self-hosted function by name. For performance, define
  * the property name in vm/CommonPropertyNames.h.
  *
  * Defined in SelfHosting.cpp.
  */
 JSFunction *
 SelfHostedFunction(JSContext *cx, HandlePropertyName propName);
 
-} /* namespace js */
-
 #ifdef va_start
 extern bool
-js_ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap);
+ReportErrorVA(JSContext *cx, unsigned flags, const char *format, va_list ap);
 
 extern bool
-js_ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback,
-                       void *userRef, const unsigned errorNumber,
-                       js::ErrorArgumentsType argumentsType, va_list ap);
+ReportErrorNumberVA(JSContext *cx, unsigned flags, JSErrorCallback callback,
+                    void *userRef, const unsigned errorNumber,
+                    ErrorArgumentsType argumentsType, va_list ap);
 
 extern bool
-js_ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callback,
-                            void *userRef, const unsigned errorNumber,
-                            const char16_t **args);
+ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callback,
+                         void *userRef, const unsigned errorNumber,
+                         const char16_t **args);
 #endif
 
 extern bool
-js_ExpandErrorArguments(js::ExclusiveContext *cx, JSErrorCallback callback,
-                        void *userRef, const unsigned errorNumber,
-                        char **message, JSErrorReport *reportp,
-                        js::ErrorArgumentsType argumentsType, va_list ap);
-
-namespace js {
+ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback,
+                     void *userRef, const unsigned errorNumber,
+                     char **message, JSErrorReport *reportp,
+                     ErrorArgumentsType argumentsType, va_list ap);
 
 /* |callee| requires a usage string provided by JS_DefineFunctionsWithHelp. */
 extern void
 ReportUsageError(JSContext *cx, HandleObject callee, const char *msg);
 
 /*
  * Prints a full report and returns true if the given report is non-nullptr
  * and the report doesn't have the JSREPORT_WARNING flag set or reportWarnings
@@ -605,53 +601,52 @@ PrintError(JSContext *cx, FILE *file, co
            bool reportWarnings);
 
 /*
  * Send a JSErrorReport to the errorReporter callback.
  */
 void
 CallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report);
 
-} /* namespace js */
-
 extern void
-js_ReportIsNotDefined(JSContext *cx, const char *name);
+ReportIsNotDefined(JSContext *cx, const char *name);
 
 /*
  * Report an attempt to access the property of a null or undefined value (v).
  */
 extern bool
-js_ReportIsNullOrUndefined(JSContext *cx, int spindex, js::HandleValue v,
-                           js::HandleString fallback);
+ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v, HandleString fallback);
 
 extern void
-js_ReportMissingArg(JSContext *cx, js::HandleValue v, unsigned arg);
+ReportMissingArg(JSContext *cx, js::HandleValue v, unsigned arg);
 
 /*
  * Report error using js_DecompileValueGenerator(cx, spindex, v, fallback) as
  * the first argument for the error message. If the error message has less
  * then 3 arguments, use null for arg1 or arg2.
  */
 extern bool
-js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumber,
-                         int spindex, js::HandleValue v, js::HandleString fallback,
-                         const char *arg1, const char *arg2);
+ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumber,
+                      int spindex, HandleValue v, HandleString fallback,
+                      const char *arg1, const char *arg2);
 
-#define js_ReportValueError(cx,errorNumber,spindex,v,fallback)                \
-    ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,          \
+#define ReportValueError(cx,errorNumber,spindex,v,fallback)                   \
+    ((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,             \
                                     spindex, v, fallback, nullptr, nullptr))
 
-#define js_ReportValueError2(cx,errorNumber,spindex,v,fallback,arg1)          \
-    ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,          \
+#define ReportValueError2(cx,errorNumber,spindex,v,fallback,arg1)             \
+    ((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,             \
                                     spindex, v, fallback, arg1, nullptr))
 
-#define js_ReportValueError3(cx,errorNumber,spindex,v,fallback,arg1,arg2)     \
-    ((void)js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,          \
+#define ReportValueError3(cx,errorNumber,spindex,v,fallback,arg1,arg2)        \
+    ((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,             \
                                     spindex, v, fallback, arg1, arg2))
 
+} /* namespace js */
+
 extern const JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
 
 namespace js {
 
 MOZ_ALWAYS_INLINE bool
 CheckForInterrupt(JSContext *cx)
 {
     // Add an inline fast-path since we have to check for interrupts in some hot
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -328,17 +328,17 @@ CallSetter(JSContext *cx, HandleObject o
            bool strict, MutableHandleValue vp)
 {
     if (attrs & JSPROP_SETTER) {
         RootedValue opv(cx, CastAsObjectJsval(op));
         return InvokeGetterOrSetter(cx, obj, opv, 1, vp.address(), vp);
     }
 
     if (attrs & JSPROP_GETTER)
-        return js_ReportGetterOnlyAssignment(cx, strict);
+        return ReportGetterOnlyAssignment(cx, strict);
 
     if (!op)
         return true;
 
     return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp);
 }
 
 inline uintptr_t
@@ -363,17 +363,17 @@ ExclusiveContext::typeLifoAlloc()
 }
 
 }  /* namespace js */
 
 inline void
 JSContext::setPendingException(js::Value v)
 {
     MOZ_ASSERT(!IsPoisonedValue(v));
-    // overRecursed_ is set after the fact by js_ReportOverRecursed.
+    // overRecursed_ is set after the fact by ReportOverRecursed.
     this->overRecursed_ = false;
     this->throwing = true;
     this->unwrappedException_ = v;
     // We don't use assertSameCompartment here to allow
     // js::SetPendingExceptionCrossContext to work.
     MOZ_ASSERT_IF(v.isObject(), v.toObject().compartment() == compartment());
 }
 
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -138,17 +138,17 @@ JSRuntime::createJitRuntime(JSContext *c
 
     // Protect jitRuntime_ from being observed (by InterruptRunningJitCode)
     // while it is being initialized. Unfortunately, initialization depends on
     // jitRuntime_ being non-null, so we can't just wait to assign jitRuntime_.
     JitRuntime::AutoMutateBackedges amb(jrt);
     jitRuntime_ = jrt;
 
     if (!jitRuntime_->initialize(cx)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
 
         js_delete(jitRuntime_);
         jitRuntime_ = nullptr;
 
         JSCompartment *comp = cx->runtime()->atomsCompartment();
         if (comp->jitCompartment_) {
             js_delete(comp->jitCompartment_);
             comp->jitCompartment_ = nullptr;
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -2424,17 +2424,17 @@ date_toGMTString(JSContext *cx, unsigned
 }
 
 /* ES6 draft 2015-01-15 20.3.4.36. */
 MOZ_ALWAYS_INLINE bool
 date_toISOString_impl(JSContext *cx, CallArgs args)
 {
     double utctime = args.thisv().toObject().as<DateObject>().UTCTime().toNumber();
     if (!IsFinite(utctime)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_DATE);
+        JS_ReportErrorNumber(cx, js::GetErrorMessage, nullptr, JSMSG_INVALID_DATE);
         return false;
     }
 
     char buf[100];
     int year = int(YearFromTime(utctime));
     if (year < 0 || year > 9999)
         print_iso_extended_string(buf, sizeof buf, utctime);
     else
@@ -2479,17 +2479,17 @@ date_toJSON(JSContext *cx, unsigned argc
 
     /* Step 4. */
     RootedValue toISO(cx);
     if (!GetProperty(cx, obj, obj, cx->names().toISOString, &toISO))
         return false;
 
     /* Step 5. */
     if (!IsCallable(toISO)) {
-        JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+        JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js::GetErrorMessage, nullptr,
                                      JSMSG_BAD_TOISOSTRING_PROP);
         return false;
     }
 
     /* Step 6. */
     InvokeArgs args2(cx);
     if (!args2.init(0))
         return false;
@@ -2952,17 +2952,17 @@ static const JSFunctionSpec date_methods
     JS_FN(js_toSource_str,       date_toSource,           0,0),
 #endif
     JS_FN(js_toString_str,       date_toString,           0,0),
     JS_FN(js_valueOf_str,        date_valueOf,            0,0),
     JS_FS_END
 };
 
 bool
-js_Date(JSContext *cx, unsigned argc, Value *vp)
+js::DateConstructor(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     /* Date called as function. */
     if (!args.isConstructing())
         return date_format(cx, NowAsMillis(), FORMATSPEC_FULL, args.rval());
 
     /* Date called as constructor. */
@@ -3004,17 +3004,17 @@ js_Date(JSContext *cx, unsigned argc, Va
 
         if (IsFinite(msec_time)) {
             msec_time = UTC(msec_time, &cx->runtime()->dateTimeInfo);
             msec_time = TimeClip(msec_time);
         }
         d = msec_time;
     }
 
-    JSObject *obj = js_NewDateObjectMsec(cx, d);
+    JSObject *obj = NewDateObjectMsec(cx, d);
     if (!obj)
         return false;
 
     args.rval().setObject(*obj);
     return true;
 }
 
 static bool
@@ -3046,42 +3046,42 @@ const Class DateObject::class_ = {
     nullptr, /* resolve */
     date_convert,
     nullptr, /* finalize */
     nullptr, /* call */
     nullptr, /* hasInstance */
     nullptr, /* construct */
     nullptr, /* trace */
     {
-        GenericCreateConstructor<js_Date, MAXARGS, JSFunction::FinalizeKind>,
+        GenericCreateConstructor<DateConstructor, MAXARGS, JSFunction::FinalizeKind>,
         GenericCreatePrototype,
         date_static_methods,
         date_methods,
         nullptr,
         FinishDateClassInit
     }
 };
 
 JS_FRIEND_API(JSObject *)
-js_NewDateObjectMsec(JSContext *cx, double msec_time)
+js::NewDateObjectMsec(JSContext *cx, double msec_time)
 {
     JSObject *obj = NewBuiltinClassInstance(cx, &DateObject::class_);
     if (!obj)
         return nullptr;
     obj->as<DateObject>().setUTCTime(msec_time);
     return obj;
 }
 
 JS_FRIEND_API(JSObject *)
-js_NewDateObject(JSContext *cx, int year, int mon, int mday,
-                 int hour, int min, int sec)
+js::NewDateObject(JSContext *cx, int year, int mon, int mday,
+                  int hour, int min, int sec)
 {
     MOZ_ASSERT(mon < 12);
     double msec_time = date_msecFromDate(year, mon, mday, hour, min, sec, 0);
-    return js_NewDateObjectMsec(cx, UTC(msec_time, &cx->runtime()->dateTimeInfo));
+    return NewDateObjectMsec(cx, UTC(msec_time, &cx->runtime()->dateTimeInfo));
 }
 
 JS_FRIEND_API(bool)
 js::DateIsValid(JSContext *cx, JSObject *objArg)
 {
     RootedObject obj(cx, objArg);
     if (!ObjectClassIs(obj, ESClass_Date, cx))
         return false;
--- a/js/src/jsdate.h
+++ b/js/src/jsdate.h
@@ -11,43 +11,43 @@
 #ifndef jsdate_h
 #define jsdate_h
 
 #include "jstypes.h"
 
 #include "js/RootingAPI.h"
 #include "js/TypeDecls.h"
 
+namespace js {
+
 /*
  * These functions provide a C interface to the date/time object
  */
 
 /*
  * Construct a new Date Object from a time value given in milliseconds UTC
  * since the epoch.
  */
 extern JS_FRIEND_API(JSObject *)
-js_NewDateObjectMsec(JSContext* cx, double msec_time);
+NewDateObjectMsec(JSContext *cx, double msec_time);
 
 /*
  * Construct a new Date Object from an exploded local time value.
  *
  * Assert that mon < 12 to help catch off-by-one user errors, which are common
  * due to the 0-based month numbering copied into JS from Java (java.util.Date
  * in 1995).
  */
 extern JS_FRIEND_API(JSObject *)
-js_NewDateObject(JSContext* cx, int year, int mon, int mday,
-                 int hour, int min, int sec);
+NewDateObject(JSContext *cx, int year, int mon, int mday,
+              int hour, int min, int sec);
 
 /* Date constructor native. Exposed only so the JIT can know its address. */
 bool
-js_Date(JSContext *cx, unsigned argc, JS::Value *vp);
-
-namespace js {
+DateConstructor(JSContext *cx, unsigned argc, JS::Value *vp);
 
 /* Date methods exposed so they can be installed in the self-hosting global. */
 bool
 date_now(JSContext *cx, unsigned argc, JS::Value *vp);
 
 bool
 date_valueOf(JSContext *cx, unsigned argc, JS::Value *vp);
 
--- a/js/src/jsdtoa.cpp
+++ b/js/src/jsdtoa.cpp
@@ -494,21 +494,21 @@ js_dtobasestr(DtoaState *state, int base
         Bfree(PASS_STATE mhi);
     }
     MOZ_ASSERT(p < buffer + DTOBASESTR_BUFFER_SIZE);
     *p = '\0';
     return buffer;
 }
 
 DtoaState *
-js_NewDtoaState()
+js::NewDtoaState()
 {
     return newdtoa();
 }
 
 void
-js_DestroyDtoaState(DtoaState *state)
+js::DestroyDtoaState(DtoaState *state)
 {
     destroydtoa(state);
 }
 
 /* Cleanup pollution from dtoa.c */
 #undef Bias
--- a/js/src/jsdtoa.h
+++ b/js/src/jsdtoa.h
@@ -11,21 +11,25 @@
  * Public interface to portable double-precision floating point to string
  * and back conversion package.
  */
 
 #include <stddef.h>
 
 struct DtoaState;
 
-DtoaState *
-js_NewDtoaState();
+namespace js {
+
+extern DtoaState *
+NewDtoaState();
 
-void
-js_DestroyDtoaState(DtoaState *state);
+extern void
+DestroyDtoaState(DtoaState *state);
+
+} // namespace js
 
 /*
  * js_strtod_harder() returns as a double-precision floating-point number the
  * value represented by the character string pointed to by s00. The string is
  * scanned up to the first unrecognized character.
  *
  * If se is not nullptr, *se receives a pointer to the character terminating
  * the scan. If no number can be formed, *se receives a pointer to the first
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -330,17 +330,17 @@ js::ComputeStackString(JSContext *cx)
 static void
 exn_finalize(FreeOp *fop, JSObject *obj)
 {
     if (JSErrorReport *report = obj->as<ErrorObject>().getErrorReport())
         fop->free_(report);
 }
 
 JSErrorReport *
-js_ErrorFromException(JSContext *cx, HandleObject objArg)
+js::ErrorFromException(JSContext *cx, HandleObject objArg)
 {
     // It's ok to UncheckedUnwrap here, since all we do is get the
     // JSErrorReport, and consumers are careful with the information they get
     // from that anyway.  Anyone doing things that would expose anything in the
     // JSErrorReport to page script either does a security check on the
     // JSErrorReport's principal or also tries to do toString on our object and
     // will fail if they can't unwrap it.
     RootedObject obj(cx, UncheckedUnwrap(objArg));
@@ -537,28 +537,28 @@ js::GetErrorTypeName(JSRuntime *rt, int1
     {
         return nullptr;
     }
     JSProtoKey key = GetExceptionProtoKey(JSExnType(exnType));
     return ClassName(key, rt);
 }
 
 bool
-js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp,
-                    JSErrorCallback callback, void *userRef)
+js::ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp,
+                     JSErrorCallback callback, void *userRef)
 {
     // Tell our caller to report immediately if this report is just a warning.
     MOZ_ASSERT(reportp);
     if (JSREPORT_IS_WARNING(reportp->flags))
         return false;
 
     // Find the exception index associated with this error.
     JSErrNum errorNumber = static_cast<JSErrNum>(reportp->errorNumber);
     if (!callback)
-        callback = js_GetErrorMessage;
+        callback = GetErrorMessage;
     const JSErrorFormatString *errorString = callback(userRef, errorNumber);
     JSExnType exnType = errorString ? static_cast<JSExnType>(errorString->exnType) : JSEXN_NONE;
     MOZ_ASSERT(exnType < JSEXN_LIMIT);
 
     // Return false (no exception raised) if no exception is associated
     // with the given error number.
     if (exnType == JSEXN_NONE)
         return false;
@@ -640,17 +640,17 @@ js::ErrorReportToString(JSContext *cx, J
         return nullptr;
     toAppend = JS_NewUCStringCopyZ(cx, reportp->ucmessage);
     if (toAppend)
         str = ConcatStrings<CanGC>(cx, str, toAppend);
     return str;
 }
 
 bool
-js_ReportUncaughtException(JSContext *cx)
+js::ReportUncaughtException(JSContext *cx)
 {
     if (!cx->isExceptionPending())
         return true;
 
     RootedValue exn(cx);
     if (!cx->getPendingException(&exn))
         return false;
 
@@ -681,17 +681,17 @@ ErrorReport::ErrorReport(JSContext *cx)
 ErrorReport::~ErrorReport()
 {
     if (!ownedMessage)
         return;
 
     js_free(ownedMessage);
     if (ownedReport.messageArgs) {
         /*
-         * js_ExpandErrorArguments owns its messageArgs only if it had to
+         * ExpandErrorArguments owns its messageArgs only if it had to
          * inflate the arguments (from regular |char *|s), which is always in
          * our case.
          */
         size_t i = 0;
         while (ownedReport.messageArgs[i])
             js_free(const_cast<char16_t*>(ownedReport.messageArgs[i++]));
         js_free(ownedReport.messageArgs);
     }
@@ -704,17 +704,17 @@ ErrorReport::init(JSContext *cx, HandleV
     MOZ_ASSERT(!cx->isExceptionPending());
 
     /*
      * Because ToString below could error and an exception object could become
      * unrooted, we must root our exception object, if any.
      */
     if (exn.isObject()) {
         exnObject = &exn.toObject();
-        reportp = js_ErrorFromException(cx, exnObject);
+        reportp = ErrorFromException(cx, exnObject);
 
         JSCompartment *comp = exnObject->compartment();
         JSAddonId *addonId = comp->addonId;
         if (addonId) {
             UniqueChars addonIdChars(JS_EncodeString(cx, addonId));
 
             const char *filename = nullptr;
             
@@ -741,17 +741,17 @@ ErrorReport::init(JSContext *cx, HandleV
     if (reportp)
         str = ErrorReportToString(cx, reportp);
     else
         str = ToString<CanGC>(cx, exn);
 
     if (!str)
         cx->clearPendingException();
 
-    // If js_ErrorFromException didn't get us a JSErrorReport, then the object
+    // If ErrorFromException didn't get us a JSErrorReport, then the object
     // was not an ErrorObject, security-wrapped or otherwise. However, it might
     // still quack like one. Give duck-typing a chance.  We start by looking for
     // "filename" (all lowercase), since that's where DOMExceptions store their
     // filename.  Then we check "fileName", which is where Errors store it.  We
     // have to do it in that order, because DOMExceptions have Error.prototype
     // on their proto chain, and hence also have a "fileName" property, but its
     // value is "".
     const char *filename_str = "filename";
@@ -843,17 +843,17 @@ ErrorReport::init(JSContext *cx, HandleV
     if (str)
         message_ = bytesStorage.encodeLatin1(cx, str);
     if (!message_)
         message_ = "unknown (can't convert to string)";
 
     if (!reportp) {
         // This is basically an inlined version of
         //
-        //   JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        //   JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
         //                        JSMSG_UNCAUGHT_EXCEPTION, message_);
         //
         // but without the reporting bits.  Instead it just puts all
         // the stuff we care about in our ownedReport and message_.
         if (!populateUncaughtExceptionReport(cx, message_)) {
             // Just give up.  We're out of memory or something; not much we can
             // do here.
             return false;
@@ -887,30 +887,30 @@ ErrorReport::populateUncaughtExceptionRe
     // could accept a passed-in stack of some sort instead.
     NonBuiltinFrameIter iter(cx);
     if (!iter.done()) {
         ownedReport.filename = iter.scriptFilename();
         ownedReport.lineno = iter.computeLine(&ownedReport.column);
         ownedReport.isMuted = iter.mutedErrors();
     }
 
-    if (!js_ExpandErrorArguments(cx, js_GetErrorMessage, nullptr,
-                                 JSMSG_UNCAUGHT_EXCEPTION, &ownedMessage,
-                                 &ownedReport, ArgumentsAreASCII, ap)) {
+    if (!ExpandErrorArguments(cx, GetErrorMessage, nullptr,
+                              JSMSG_UNCAUGHT_EXCEPTION, &ownedMessage,
+                              &ownedReport, ArgumentsAreASCII, ap)) {
         return false;
     }
 
     reportp = &ownedReport;
     message_ = ownedMessage;
     ownsMessageAndReport = true;
     return true;
 }
 
 JSObject *
-js_CopyErrorObject(JSContext *cx, Handle<ErrorObject*> err)
+js::CopyErrorObject(JSContext *cx, Handle<ErrorObject*> err)
 {
     js::ScopedJSFreePtr<JSErrorReport> copyReport;
     if (JSErrorReport *errorReport = err->getErrorReport()) {
         copyReport = CopyErrorReport(cx, errorReport);
         if (!copyReport)
             return nullptr;
     }
 
--- a/js/src/jsexn.h
+++ b/js/src/jsexn.h
@@ -17,17 +17,16 @@
 namespace js {
 class ErrorObject;
 
 JSErrorReport *
 CopyErrorReport(JSContext *cx, JSErrorReport *report);
 
 JSString *
 ComputeStackString(JSContext *cx);
-}
 
 /*
  * Given a JSErrorReport, check to see if there is an exception associated with
  * the error number.  If there is, then create an appropriate exception object,
  * set it as the pending exception, and set the JSREPORT_EXCEPTION flag on the
  * error report.  Exception-aware host error reporters should probably ignore
  * error reports so flagged.
  *
@@ -46,18 +45,18 @@ ComputeStackString(JSContext *cx);
  *     anywhere; instead OOM is reported.
  *
  *   - If *reportp is just a warning, or the error code is unrecognized, or if
  *     we decided to do nothing in order to avoid recursion, then return
  *     false. In those cases, this error is just being swept under the rug
  *     unless the caller decides to call CallErrorReporter explicitly.
  */
 extern bool
-js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp,
-                    JSErrorCallback callback, void *userRef);
+ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp,
+                 JSErrorCallback callback, void *userRef);
 
 /*
  * Called if a JS API call to js_Execute or js_InternalCall fails; calls the
  * error reporter with the error report associated with any uncaught exception
  * that has been raised.  Returns true if there was an exception pending, and
  * the error reporter was actually called.
  *
  * The JSErrorReport * that the error reporter is called with is currently
@@ -66,30 +65,30 @@ js_ErrorToException(JSContext *cx, const
  * should make their own copy.
  *
  * The flags field of the JSErrorReport will have the JSREPORT_EXCEPTION flag
  * set; embeddings that want to silently propagate JavaScript exceptions to
  * other contexts may want to use an error reporter that ignores errors with
  * this flag.
  */
 extern bool
-js_ReportUncaughtException(JSContext *cx);
+ReportUncaughtException(JSContext *cx);
 
 extern JSErrorReport *
-js_ErrorFromException(JSContext *cx, js::HandleObject obj);
+ErrorFromException(JSContext *cx, HandleObject obj);
 
 /*
  * Make a copy of errobj parented to cx's compartment's global.
  *
  * errobj may be in a different compartment than cx, but it must be an Error
  * object (not a wrapper of one) and it must not be one of the standard error
  * prototype objects (errobj->getPrivate() must not be nullptr).
  */
 extern JSObject *
-js_CopyErrorObject(JSContext *cx, JS::Handle<js::ErrorObject*> errobj);
+CopyErrorObject(JSContext *cx, JS::Handle<ErrorObject*> errobj);
 
 static_assert(JSEXN_ERR == 0 &&
               JSProto_Error + JSEXN_INTERNALERR == JSProto_InternalError &&
               JSProto_Error + JSEXN_EVALERR == JSProto_EvalError &&
               JSProto_Error + JSEXN_RANGEERR == JSProto_RangeError &&
               JSProto_Error + JSEXN_REFERENCEERR == JSProto_ReferenceError &&
               JSProto_Error + JSEXN_SYNTAXERR == JSProto_SyntaxError &&
               JSProto_Error + JSEXN_TYPEERR == JSProto_TypeError &&
@@ -111,9 +110,11 @@ static inline JSExnType
 ExnTypeFromProtoKey(JSProtoKey key)
 {
     JSExnType type = static_cast<JSExnType>(key - JSProto_Error);
     MOZ_ASSERT(type >= JSEXN_ERR);
     MOZ_ASSERT(type < JSEXN_LIMIT);
     return type;
 }
 
+} // namespace js
+
 #endif /* jsexn_h */
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -255,23 +255,23 @@ JS_DefineFunctionsWithHelp(JSContext *cx
                 return false;
         }
     }
 
     return true;
 }
 
 JS_FRIEND_API(bool)
-js_ObjectClassIs(JSContext *cx, HandleObject obj, ESClassValue classValue)
+js::ObjectClassIs(JSContext *cx, HandleObject obj, ESClassValue classValue)
 {
     return ObjectClassIs(obj, classValue, cx);
 }
 
 JS_FRIEND_API(const char *)
-js_ObjectClassName(JSContext *cx, HandleObject obj)
+js::ObjectClassName(JSContext *cx, HandleObject obj)
 {
     return GetObjectClassName(cx, obj);
 }
 
 JS_FRIEND_API(JS::Zone *)
 js::GetCompartmentZone(JSCompartment *comp)
 {
     return comp->zone();
@@ -1179,36 +1179,36 @@ js::SetObjectMetadata(JSContext *cx, Han
 
 JS_FRIEND_API(JSObject *)
 js::GetObjectMetadata(JSObject *obj)
 {
     return obj->getMetadata();
 }
 
 JS_FRIEND_API(bool)
-js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
-                     JS::Handle<js::PropertyDescriptor> descriptor, bool *bp)
+js::DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
+                      JS::Handle<js::PropertyDescriptor> descriptor, bool *bp)
 {
     RootedObject obj(cx, objArg);
     RootedId id(cx, idArg);
-    js::AssertHeapIsIdle(cx);
+    AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj, id, descriptor.value());
     if (descriptor.hasGetterObject())
         assertSameCompartment(cx, descriptor.getterObject());
     if (descriptor.hasSetterObject())
         assertSameCompartment(cx, descriptor.setterObject());
 
     return StandardDefineProperty(cx, obj, id, descriptor, bp);
 }
 
 JS_FRIEND_API(bool)
-js_ReportIsNotFunction(JSContext *cx, JS::HandleValue v)
+js::ReportIsNotFunction(JSContext *cx, HandleValue v)
 {
-    return ReportIsNotFunction(cx, v);
+    return ReportIsNotFunction(cx, v, -1);
 }
 
 JS_FRIEND_API(void)
 js::ReportErrorWithId(JSContext *cx, const char *msg, HandleId id)
 {
     RootedValue idv(cx);
     if (!JS_IdToValue(cx, id, &idv))
         return;
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -166,26 +166,26 @@ JS_CloneObject(JSContext *cx, JS::Handle
 extern JS_FRIEND_API(bool)
 JS_InitializePropertiesFromCompatibleNativeObject(JSContext *cx,
                                                   JS::HandleObject dst,
                                                   JS::HandleObject src);
 
 extern JS_FRIEND_API(JSString *)
 JS_BasicObjectToString(JSContext *cx, JS::HandleObject obj);
 
-JS_FRIEND_API(void)
-js_ReportOverRecursed(JSContext *maybecx);
+namespace js {
 
 JS_FRIEND_API(bool)
-js_ObjectClassIs(JSContext *cx, JS::HandleObject obj, js::ESClassValue classValue);
+ObjectClassIs(JSContext *cx, JS::HandleObject obj, ESClassValue classValue);
 
 JS_FRIEND_API(const char *)
-js_ObjectClassName(JSContext *cx, JS::HandleObject obj);
-
-namespace js {
+ObjectClassName(JSContext *cx, JS::HandleObject obj);
+
+JS_FRIEND_API(void)
+ReportOverRecursed(JSContext *maybecx);
 
 JS_FRIEND_API(bool)
 AddRawValueRoot(JSContext *cx, JS::Value *vp, const char *name);
 
 JS_FRIEND_API(void)
 RemoveRawValueRoot(JSContext *cx, JS::Value *vp);
 
 } /* namespace js */
@@ -993,17 +993,17 @@ GetNativeStackLimit(JSContext *cx, int e
  * including a safety buffer (as in, it uses the untrusted limit and subtracts
  * a little more from it).
  */
 
 #define JS_CHECK_RECURSION_LIMIT(cx, limit, onerror)                            \
     JS_BEGIN_MACRO                                                              \
         int stackDummy_;                                                        \
         if (!JS_CHECK_STACK_SIZE(limit, &stackDummy_)) {                        \
-            js_ReportOverRecursed(cx);                                          \
+            js::ReportOverRecursed(cx);                                         \
             onerror;                                                            \
         }                                                                       \
     JS_END_MACRO
 
 #define JS_CHECK_RECURSION(cx, onerror)                                         \
     JS_CHECK_RECURSION_LIMIT(cx, js::GetNativeStackLimit(cx), onerror)
 
 #define JS_CHECK_RECURSION_DONT_REPORT(cx, onerror)                             \
@@ -1019,17 +1019,17 @@ GetNativeStackLimit(JSContext *cx, int e
         if (!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp)) {            \
             onerror;                                                            \
         }                                                                       \
     JS_END_MACRO
 
 #define JS_CHECK_RECURSION_WITH_SP(cx, sp, onerror)                             \
     JS_BEGIN_MACRO                                                              \
         if (!JS_CHECK_STACK_SIZE(js::GetNativeStackLimit(cx), sp)) {            \
-            js_ReportOverRecursed(cx);                                          \
+            js::ReportOverRecursed(cx);                                         \
             onerror;                                                            \
         }                                                                       \
     JS_END_MACRO
 
 #define JS_CHECK_SYSTEM_RECURSION(cx, onerror)                                  \
     JS_CHECK_RECURSION_LIMIT(cx, js::GetNativeStackLimit(cx, js::StackForSystemCode), onerror)
 
 #define JS_CHECK_RECURSION_CONSERVATIVE(cx, onerror)                            \
@@ -1266,20 +1266,20 @@ DateGetMsecSinceEpoch(JSContext *cx, JSO
 typedef enum JSErrNum {
 #define MSG_DEF(name, count, exception, format) \
     name,
 #include "js.msg"
 #undef MSG_DEF
     JSErr_Limit
 } JSErrNum;
 
+namespace js {
+
 extern JS_FRIEND_API(const JSErrorFormatString *)
-js_GetErrorMessage(void *userRef, const unsigned errorNumber);
-
-namespace js {
+GetErrorMessage(void *userRef, const unsigned errorNumber);
 
 // AutoStableStringChars is here so we can use it in ErrorReport.  It
 // should get moved out of here if we can manage it.  See bug 1040316.
 
 /*
  * 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
@@ -1406,25 +1406,20 @@ struct MOZ_STACK_CLASS JS_FRIEND_API(Err
 
     // And for our filename.
     JSAutoByteString filename;
 
     // True if we need to free message_ and the stuff in ownedReport
     bool ownsMessageAndReport;
 };
 
-} /* namespace js */
-
-
-/* Implemented in jsclone.cpp. */
-
+/* Implemented in vm/StructuredClone.cpp. */
 extern JS_FRIEND_API(uint64_t)
-js_GetSCOffset(JSStructuredCloneWriter* writer);
-
-namespace js {
+GetSCOffset(JSStructuredCloneWriter *writer);
+
 namespace Scalar {
 
 /* Scalar types which can appear in typed arrays and typed objects.  The enum
  * values need to be kept in sync with the JS_SCALARTYPEREPR_ constants, as
  * well as the TypedArrayObject::classes and TypedArrayObject::protoClasses
  * definitions.
  */
 enum Type {
@@ -2671,24 +2666,24 @@ GetSavedFramePrincipals(JS::HandleObject
  *
  * Do NOT pass a non-SavedFrame object here.
  *
  * The savedFrame and cx do not need to be in the same compartment.
  */
 extern JS_FRIEND_API(JSObject *)
 GetFirstSubsumedSavedFrame(JSContext *cx, JS::HandleObject savedFrame);
 
-} /* namespace js */
+extern JS_FRIEND_API(bool)
+ReportIsNotFunction(JSContext *cx, JS::HandleValue v);
 
 extern JS_FRIEND_API(bool)
-js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
-                     JS::Handle<JSPropertyDescriptor> descriptor, bool *bp);
-
-extern JS_FRIEND_API(bool)
-js_ReportIsNotFunction(JSContext *cx, JS::HandleValue v);
+DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
+                  JS::Handle<JSPropertyDescriptor> descriptor, bool *bp);
+
+} /* namespace js */
 
 extern JS_FRIEND_API(void)
 JS_StoreObjectPostBarrierCallback(JSContext* cx,
                                   void (*callback)(JSTracer *trc, JSObject *key, void *data),
                                   JSObject *key, void *data);
 
 extern JS_FRIEND_API(void)
 JS_StoreStringPostBarrierCallback(JSContext* cx,
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -99,17 +99,17 @@ AdvanceToActiveCallLinear(JSContext *cx,
             return true;
     }
     return false;
 }
 
 static void
 ThrowTypeErrorBehavior(JSContext *cx)
 {
-    JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+    JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
                                  JSMSG_THROW_TYPE_ERROR);
 }
 
 // Beware: this function can be invoked on *any* function! That includes
 // natives, strict mode functions, bound functions, arrow functions,
 // self-hosted functions and constructors, asm.js functions, functions with
 // destructuring arguments and/or a rest argument, and probably a few more I
 // forgot. Turn back and save yourself while you still can. It's too late for
@@ -126,24 +126,24 @@ ArgumentsRestrictions(JSContext *cx, Han
     {
         ThrowTypeErrorBehavior(cx);
         return false;
     }
 
     // Functions with rest arguments don't include a local |arguments| binding.
     // Similarly, "arguments" shouldn't work on them.
     if (fun->hasRest()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_FUNCTION_ARGUMENTS_AND_REST);
         return false;
     }
 
     // Otherwise emit a strict warning about |f.arguments| to discourage use of
     // this non-standard, performance-harmful feature.
-    if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, js_GetErrorMessage,
+    if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, GetErrorMessage,
                                       nullptr, JSMSG_DEPRECATED_USAGE, js_arguments_str))
     {
         return false;
     }
 
     return true;
 }
 
@@ -222,17 +222,17 @@ CallerRestrictions(JSContext *cx, Handle
         fun->isBoundFunction())
     {
         ThrowTypeErrorBehavior(cx);
         return false;
     }
 
     // Otherwise emit a strict warning about |f.caller| to discourage use of
     // this non-standard, performance-harmful feature.
-    if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, js_GetErrorMessage,
+    if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING | JSREPORT_STRICT, GetErrorMessage,
                                       nullptr, JSMSG_DEPRECATED_USAGE, js_caller_str))
     {
         return false;
     }
 
     return true;
 }
 
@@ -275,17 +275,17 @@ CallerGetterImpl(JSContext *cx, CallArgs
             args.rval().setNull();
             return true;
         }
 
         JSFunction *callerFun = &callerObj->as<JSFunction>();
         MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
 
         if (callerFun->strict()) {
-            JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+            JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
                                          JSMSG_CALLER_IS_STRICT);
             return false;
         }
     }
 
     args.rval().setObject(*caller);
     return true;
 }
@@ -337,17 +337,17 @@ CallerSetterImpl(JSContext *cx, CallArgs
     JSObject *callerObj = CheckedUnwrap(caller);
     if (!callerObj)
         return true;
 
     JSFunction *callerFun = &callerObj->as<JSFunction>();
     MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
 
     if (callerFun->strict()) {
-        JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
+        JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
                                      JSMSG_CALLER_IS_STRICT);
         return false;
     }
 
     return true;
 }
 
 static bool
@@ -535,17 +535,17 @@ js::XDRInterpretedFunction(XDRState<mode
     RootedScript script(cx);
     Rooted<LazyScript *> lazy(cx);
 
     if (mode == XDR_ENCODE) {
         fun = objp;
         if (!fun->isInterpreted()) {
             JSAutoByteString funNameBytes;
             if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+                JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                      JSMSG_NOT_SCRIPTED_FUNCTION, name);
             }
             return false;
         }
 
         if (fun->atom() || fun->hasGuessedAtom())
             firstword |= HasAtom;
 
@@ -699,17 +699,17 @@ fun_hasInstance(JSContext *cx, HandleObj
         return false;
 
     if (pval.isPrimitive()) {
         /*
          * Throw a runtime error if instanceof is called on a function that
          * has a non-object as its .prototype value.
          */
         RootedValue val(cx, ObjectValue(*obj));
-        js_ReportValueError(cx, JSMSG_BAD_PROTOTYPE, -1, val, js::NullPtr());
+        ReportValueError(cx, JSMSG_BAD_PROTOTYPE, -1, val, js::NullPtr());
         return false;
     }
 
     RootedObject pobj(cx, &pval.toObject());
     bool isDelegate;
     if (!IsDelegate(cx, pobj, v, &isDelegate))
         return false;
     *bp = isDelegate;
@@ -880,17 +880,17 @@ CreateFunctionPrototype(JSContext *cx, J
         return nullptr;
 
     bool succeeded;
     RootedFunction throwTypeError(cx, NewFunction(cx, tte, ThrowTypeError, 0,
                                                   JSFunction::NATIVE_FUN, self, js::NullPtr()));
     if (!throwTypeError || !PreventExtensions(cx, throwTypeError, &succeeded))
         return nullptr;
     if (!succeeded) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
         return nullptr;
     }
 
     self->setThrowTypeError(throwTypeError);
 
     return functionProto;
 }
 
@@ -1165,17 +1165,17 @@ js::FunctionToString(JSContext *cx, Hand
 }
 
 JSString *
 fun_toStringHelper(JSContext *cx, HandleObject obj, unsigned indent)
 {
     if (!obj->is<JSFunction>()) {
         if (obj->is<ProxyObject>())
             return Proxy::fun_toString(cx, obj, indent);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_INCOMPATIBLE_PROTO,
                              js_Function_str, js_toString_str,
                              "object");
         return nullptr;
     }
 
     RootedFunction fun(cx, &obj->as<JSFunction>());
     return FunctionToString(cx, fun, false, indent != JS_DONT_PRETTY_PRINT);
@@ -1224,17 +1224,17 @@ fun_toSource(JSContext *cx, unsigned arg
     if (!str)
         return false;
     args.rval().setString(str);
     return true;
 }
 #endif
 
 bool
-js_fun_call(JSContext *cx, unsigned argc, Value *vp)
+js::fun_call(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     HandleValue fval = args.thisv();
     if (!IsCallable(fval)) {
         ReportIncompatibleMethod(cx, args, &JSFunction::class_);
         return false;
     }
@@ -1248,30 +1248,30 @@ js_fun_call(JSContext *cx, unsigned argc
         args = CallArgsFromVp(args.length() - 1, vp);
     }
 
     return Invoke(cx, args);
 }
 
 // ES5 15.3.4.3
 bool
-js_fun_apply(JSContext *cx, unsigned argc, Value *vp)
+js::fun_apply(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     HandleValue fval = args.thisv();
     if (!IsCallable(fval)) {
         ReportIncompatibleMethod(cx, args, &JSFunction::class_);
         return false;
     }
 
     // Step 2.
     if (args.length() < 2 || args[1].isNullOrUndefined())
-        return js_fun_call(cx, (args.length() > 0) ? 1 : 0, vp);
+        return fun_call(cx, (args.length() > 0) ? 1 : 0, vp);
 
     InvokeArgs args2(cx);
 
     // A JS_OPTIMIZED_ARGUMENTS magic value means that 'arguments' flows into
     // this apply call from a scripted caller and, as an optimization, we've
     // avoided creating it since apply can simply pull the argument values from
     // the calling frame (which we must do now).
     if (args[1].isMagic(JS_OPTIMIZED_ARGUMENTS)) {
@@ -1284,31 +1284,31 @@ js_fun_apply(JSContext *cx, unsigned arg
         args2.setCallee(fval);
         args2.setThis(args[0]);
 
         // Steps 7-8.
         iter.unaliasedForEachActual(cx, CopyTo(args2.array()));
     } else {
         // Step 3.
         if (!args[1].isObject()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                  JSMSG_BAD_APPLY_ARGS, js_apply_str);
             return false;
         }
 
         // Steps 4-5 (note erratum removing steps originally numbered 5 and 7 in
         // original version of ES5).
         RootedObject aobj(cx, &args[1].toObject());
         uint32_t length;
         if (!GetLengthProperty(cx, aobj, &length))
             return false;
 
         // Step 6.
         if (length > ARGS_LENGTH_MAX) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_TOO_MANY_FUN_APPLY_ARGS);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TOO_MANY_FUN_APPLY_ARGS);
             return false;
         }
 
         if (!args2.init(length))
             return false;
 
         // Push fval, obj, and aobj's elements as args.
         args2.setCallee(fval);
@@ -1566,17 +1566,17 @@ js::CallOrConstructBoundFunction(JSConte
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedFunction fun(cx, &args.callee().as<JSFunction>());
     MOZ_ASSERT(fun->isBoundFunction());
 
     /* 15.3.4.5.1 step 1, 15.3.4.5.2 step 3. */
     unsigned argslen = fun->getBoundFunctionArgumentCount();
 
     if (args.length() + argslen > ARGS_LENGTH_MAX) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return false;
     }
 
     /* 15.3.4.5.1 step 3, 15.3.4.5.2 step 1. */
     RootedObject target(cx, fun->getBoundFunctionTarget());
 
     /* 15.3.4.5.1 step 2. */
     const Value &boundThis = fun->getBoundFunctionThis();
@@ -1639,28 +1639,28 @@ js::fun_bind(JSContext *cx, unsigned arg
     if (args.length() > 1) {
         boundArgs = args.array() + 1;
         argslen = args.length() - 1;
     }
 
     // Steps 4-14.
     RootedValue thisArg(cx, args.length() >= 1 ? args[0] : UndefinedValue());
     RootedObject target(cx, &thisv.toObject());
-    JSObject *boundFunction = js_fun_bind(cx, target, thisArg, boundArgs, argslen);
+    JSObject *boundFunction = fun_bind(cx, target, thisArg, boundArgs, argslen);
     if (!boundFunction)
         return false;
 
     // Step 15.
     args.rval().setObject(*boundFunction);
     return true;
 }
 
 JSObject*
-js_fun_bind(JSContext *cx, HandleObject target, HandleValue thisArg,
-            Value *boundArgs, unsigned argslen)
+js::fun_bind(JSContext *cx, HandleObject target, HandleValue thisArg,
+             Value *boundArgs, unsigned argslen)
 {
     double length = 0.0;
     // Try to avoid invoking the resolve hook.
     if (target->is<JSFunction>() && !target->as<JSFunction>().hasResolvedLength()) {
         uint16_t len;
         if (!target->as<JSFunction>().getLength(cx, &len))
             return nullptr;
         length = Max(0.0, double(len) - argslen);
@@ -1736,42 +1736,42 @@ js_fun_bind(JSContext *cx, HandleObject 
 
 /*
  * Report "malformed formal parameter" iff no illegal char or similar scanner
  * error was already reported.
  */
 static bool
 OnBadFormal(JSContext *cx)
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_FORMAL);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_FORMAL);
     return false;
 }
 
 const JSFunctionSpec js::function_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,   fun_toSource,   0,0),
 #endif
     JS_FN(js_toString_str,   fun_toString,   0,0),
-    JS_FN(js_apply_str,      js_fun_apply,   2,0),
-    JS_FN(js_call_str,       js_fun_call,    1,0),
+    JS_FN(js_apply_str,      fun_apply,      2,0),
+    JS_FN(js_call_str,       fun_call,       1,0),
     JS_FN("bind",            fun_bind,       1,0),
     JS_FN("isGenerator",     fun_isGenerator,0,0),
     JS_FS_END
 };
 
 static bool
 FunctionConstructor(JSContext *cx, unsigned argc, Value *vp, GeneratorKind generatorKind)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedString arg(cx);   // used multiple times below
 
     /* Block this call if security callbacks forbid it. */
     Rooted<GlobalObject*> global(cx, &args.callee().global());
     if (!GlobalObject::isRuntimeCodeGenEnabled(cx, global)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_FUNCTION);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_FUNCTION);
         return false;
     }
 
     AutoKeepAtoms keepAtoms(cx->perThreadData);
     AutoNameVector formals(cx);
 
     bool hasRest = false;
 
@@ -1823,39 +1823,39 @@ FunctionConstructor(JSContext *cx, unsig
 
             /*
              * Check for overflow.  The < test works because the maximum
              * JSString length fits in 2 fewer bits than size_t has.
              */
             size_t old_args_length = args_length;
             args_length = old_args_length + arg->length();
             if (args_length < old_args_length) {
-                js_ReportAllocationOverflow(cx);
+                ReportAllocationOverflow(cx);
                 return false;
             }
         }
 
         /* Add 1 for each joining comma and check for overflow (two ways). */
         size_t old_args_length = args_length;
         args_length = old_args_length + n - 1;
         if (args_length < old_args_length ||
             args_length >= ~(size_t)0 / sizeof(char16_t)) {
-            js_ReportAllocationOverflow(cx);
+            ReportAllocationOverflow(cx);
             return false;
         }
 
         /*
          * Allocate a string to hold the concatenated arguments, including room
          * for a terminating 0. Mark cx->tempLifeAlloc for later release, to
          * free collected_args and its tokenstream in one swoop.
          */
         LifoAllocScope las(&cx->tempLifoAlloc());
         char16_t *cp = cx->tempLifoAlloc().newArray<char16_t>(args_length + 1);
         if (!cp) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
         ConstTwoByteChars collected_args(cp, args_length + 1);
 
         /*
          * Concatenate the arguments into the new string, separated by commas.
          */
         for (unsigned i = 0; i < n; i++) {
@@ -2251,29 +2251,29 @@ js::ReportIncompatibleMethod(JSContext *
     } else {
         MOZ_ASSERT(thisv.isUndefined() || thisv.isNull());
     }
 #endif
 
     if (JSFunction *fun = ReportIfNotFunction(cx, call.calleev())) {
         JSAutoByteString funNameBytes;
         if (const char *funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
                                  clasp->name, funName, InformalValueTypeName(thisv));
         }
     }
 }
 
 void
 js::ReportIncompatible(JSContext *cx, CallReceiver call)
 {
     if (JSFunction *fun = ReportIfNotFunction(cx, call.calleev())) {
         JSAutoByteString funNameBytes;
         if (const char *funName = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_METHOD,
                                  funName, "method", InformalValueTypeName(call.thisv()));
         }
     }
 }
 
 namespace JS {
 namespace detail {
 
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -658,27 +658,27 @@ ReportIncompatibleMethod(JSContext *cx, 
 extern void
 ReportIncompatible(JSContext *cx, CallReceiver call);
 
 bool
 CallOrConstructBoundFunction(JSContext *, unsigned, js::Value *);
 
 extern const JSFunctionSpec function_methods[];
 
-} /* namespace js */
-
 extern bool
-js_fun_apply(JSContext *cx, unsigned argc, js::Value *vp);
+fun_apply(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
-js_fun_call(JSContext *cx, unsigned argc, js::Value *vp);
+fun_call(JSContext *cx, unsigned argc, Value *vp);
 
 extern JSObject *
-js_fun_bind(JSContext *cx, js::HandleObject target, js::HandleValue thisArg,
-            js::Value *boundArgs, unsigned argslen);
+fun_bind(JSContext *cx, HandleObject target, HandleValue thisArg,
+         Value *boundArgs, unsigned argslen);
+
+} /* namespace js */
 
 #ifdef DEBUG
 namespace JS {
 namespace detail {
 
 JS_PUBLIC_API(void)
 CheckIsValidConstructible(Value calleev);
 
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -3030,17 +3030,17 @@ GCRuntime::refillFreeListFromMainThread(
 
     // Retry the allocation after the last-ditch GC.
     thing = tryRefillFreeListFromMainThread(cx, thingKind);
     if (thing)
         return thing;
 
     // We are really just totally out of memory.
     MOZ_ASSERT(allowGC, "A fallible allocation must not report OOM on failure.");
-    js_ReportOutOfMemory(cx);
+    ReportOutOfMemory(cx);
     return nullptr;
 }
 
 /* static */ void *
 GCRuntime::refillFreeListOffMainThread(ExclusiveContext *cx, AllocKind thingKind)
 {
     ArenaLists *arenas = cx->arenas();
     Zone *zone = cx->zone();
@@ -3054,17 +3054,17 @@ GCRuntime::refillFreeListOffMainThread(E
     AutoLockHelperThreadState lock;
     while (rt->isHeapBusy())
         HelperThreadState().wait(GlobalHelperThreadState::PRODUCER);
 
     void *thing = arenas->allocateFromArena(zone, thingKind, maybeStartBGAlloc);
     if (thing)
         return thing;
 
-    js_ReportOutOfMemory(cx);
+    ReportOutOfMemory(cx);
     return nullptr;
 }
 
 template <AllowGC allowGC>
 /* static */ void *
 GCRuntime::refillFreeListFromAnyThread(ExclusiveContext *cx, AllocKind thingKind)
 {
     MOZ_ASSERT(cx->arenas()->freeLists[thingKind].isEmpty());
@@ -6541,22 +6541,22 @@ js::NewCompartment(JSContext *cx, Zone *
         return nullptr;
 
     // Set up the principals.
     JS_SetCompartmentPrincipals(compartment, principals);
 
     AutoLockGC lock(rt);
 
     if (!zone->compartments.append(compartment.get())) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     if (zoneHolder && !rt->gc.zones.append(zone)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
 
     zoneHolder.forget();
     return compartment.forget();
 }
 
 void
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -849,25 +849,21 @@ class ArenaLists
     friend class GCRuntime;
 };
 
 /* The number of GC cycles an empty chunk can survive before been released. */
 const size_t MAX_EMPTY_CHUNK_AGE = 4;
 
 } /* namespace gc */
 
-} /* namespace js */
-
 extern bool
-js_InitGC(JSRuntime *rt, uint32_t maxbytes);
+InitGC(JSRuntime *rt, uint32_t maxbytes);
 
 extern void
-js_FinishGC(JSRuntime *rt);
-
-namespace js {
+FinishGC(JSRuntime *rt);
 
 class InterpreterFrame;
 
 extern void
 MarkCompartmentActive(js::InterpreterFrame *fp);
 
 extern void
 TraceRuntime(JSTracer *trc);
@@ -1107,22 +1103,18 @@ typedef void (*IterateScriptCallback)(JS
 /*
  * Invoke scriptCallback on every in-use script for
  * the given compartment or for all compartments if it is null.
  */
 extern void
 IterateScripts(JSRuntime *rt, JSCompartment *compartment,
                void *data, IterateScriptCallback scriptCallback);
 
-} /* namespace js */
-
 extern void
-js_FinalizeStringRT(JSRuntime *rt, JSString *str);
-
-namespace js {
+FinalizeStringRT(JSRuntime *rt, JSString *str);
 
 JSCompartment *
 NewCompartment(JSContext *cx, JS::Zone *zone, JSPrincipals *principals,
                const JS::CompartmentOptions &options);
 
 namespace gc {
 
 /*
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -469,17 +469,17 @@ CheckAllocatorState(ExclusiveContext *cx
 #endif
 
     // Crash if we perform a GC action when it is not safe.
     if (allowGC && !rt->mainThread.suppressGC)
         JS::AutoAssertOnGC::VerifyIsSafeToGC(rt);
 
     // For testing out of memory conditions
     if (!PossiblyFail()) {
-        js_ReportOutOfMemory(ncx);
+        ReportOutOfMemory(ncx);
         return false;
     }
 
     return true;
 }
 
 template <typename T>
 static inline void
@@ -671,30 +671,30 @@ NewGCShape(ExclusiveContext *cx)
 }
 
 inline Shape *
 NewGCAccessorShape(ExclusiveContext *cx)
 {
     return gc::AllocateNonObject<AccessorShape, CanGC>(cx);
 }
 
-} /* namespace js */
-
 inline JSScript *
-js_NewGCScript(js::ExclusiveContext *cx)
+NewGCScript(ExclusiveContext *cx)
 {
-    return js::gc::AllocateNonObject<JSScript, js::CanGC>(cx);
+    return gc::AllocateNonObject<JSScript, CanGC>(cx);
 }
 
-inline js::LazyScript *
-js_NewGCLazyScript(js::ExclusiveContext *cx)
+inline LazyScript *
+NewGCLazyScript(ExclusiveContext *cx)
 {
-    return js::gc::AllocateNonObject<js::LazyScript, js::CanGC>(cx);
+    return gc::AllocateNonObject<LazyScript, CanGC>(cx);
 }
 
-template <js::AllowGC allowGC>
-inline js::BaseShape *
-js_NewGCBaseShape(js::ExclusiveContext *cx)
+template <AllowGC allowGC>
+inline BaseShape *
+NewGCBaseShape(ExclusiveContext *cx)
 {
-    return js::gc::AllocateNonObject<js::BaseShape, allowGC>(cx);
+    return gc::AllocateNonObject<BaseShape, allowGC>(cx);
 }
 
+} /* namespace js */
+
 #endif /* jsgcinlines_h */
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -445,18 +445,18 @@ GetCustomIterator(JSContext *cx, HandleO
         /*
          * We are always coming from js::ValueToIterator, and we are no longer on
          * trace, so the object we are iterating over is on top of the stack (-1).
          */
         JSAutoByteString bytes;
         if (!AtomToPrintableString(cx, name, &bytes))
             return false;
         RootedValue val(cx, ObjectValue(*obj));
-        js_ReportValueError2(cx, JSMSG_BAD_TRAP_RETURN_VALUE,
-                             -1, val, js::NullPtr(), bytes.ptr());
+        ReportValueError2(cx, JSMSG_BAD_TRAP_RETURN_VALUE,
+                          -1, val, js::NullPtr(), bytes.ptr());
         return false;
     }
     objp.set(&rval.toObject());
     return true;
 }
 
 template <typename T>
 static inline bool
@@ -853,17 +853,17 @@ js::ThrowStopIteration(JSContext *cx)
 
 /*** Iterator objects ****************************************************************************/
 
 bool
 js::IteratorConstructor(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() == 0) {
-        js_ReportMissingArg(cx, args.calleev(), 0);
+        ReportMissingArg(cx, args.calleev(), 0);
         return false;
     }
 
     bool keyonly = false;
     if (args.length() >= 2)
         keyonly = ToBoolean(args[1]);
     unsigned flags = JSITER_OWNONLY | (keyonly ? 0 : (JSITER_FOREACH | JSITER_KEYVALUE));
 
@@ -1442,17 +1442,17 @@ GlobalObject::initStopIterationClass(JSC
         return false;
 
     global->setConstructor(JSProto_StopIteration, ObjectValue(*proto));
 
     return true;
 }
 
 JSObject *
-js_InitIteratorClasses(JSContext *cx, HandleObject obj)
+js::InitIteratorClasses(JSContext *cx, HandleObject obj)
 {
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
     if (!GlobalObject::initIteratorClasses(cx, global))
         return nullptr;
     if (!GlobalObject::initGeneratorClasses(cx, global))
         return nullptr;
     return global->getIteratorPrototype();
 }
--- a/js/src/jsiter.h
+++ b/js/src/jsiter.h
@@ -207,14 +207,14 @@ ThrowStopIteration(JSContext *cx);
 
 /*
  * Create an object of the form { value: VALUE, done: DONE }.
  * ES6 draft from 2013-09-05, section 25.4.3.4.
  */
 extern JSObject *
 CreateItrResultObject(JSContext *cx, HandleValue value, bool done);
 
+extern JSObject *
+InitIteratorClasses(JSContext *cx, HandleObject obj);
+
 } /* namespace js */
 
-extern JSObject *
-js_InitIteratorClasses(JSContext *cx, js::HandleObject obj);
-
 #endif /* jsiter_h */
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -1602,17 +1602,17 @@ static const JSFunctionSpec math_static_
     JS_FN("hypot",          math_hypot,           2, 0),
     JS_FN("trunc",          math_trunc,           1, 0),
     JS_FN("sign",           math_sign,            1, 0),
     JS_FN("cbrt",           math_cbrt,            1, 0),
     JS_FS_END
 };
 
 JSObject *
-js_InitMathClass(JSContext *cx, HandleObject obj)
+js::InitMathClass(JSContext *cx, HandleObject obj)
 {
     RootedObject proto(cx, obj->as<GlobalObject>().getOrCreateObjectPrototype(cx));
     if (!proto)
         return nullptr;
     RootedObject Math(cx, NewObjectWithGivenProto(cx, &MathClass, proto, obj, SingletonObject));
     if (!Math)
         return nullptr;
 
--- a/js/src/jsmath.h
+++ b/js/src/jsmath.h
@@ -78,26 +78,22 @@ class MathCache
         e.in = x;
         e.id = id;
         return e.out = f(x);
     }
 
     size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
 };
 
-} /* namespace js */
-
 /*
  * JS math functions.
  */
 
 extern JSObject *
-js_InitMathClass(JSContext *cx, js::HandleObject obj);
-
-namespace js {
+InitMathClass(JSContext *cx, HandleObject obj);
 
 extern void
 random_initState(uint64_t *rngState);
 
 extern uint64_t
 random_next(uint64_t *rngState, int bits);
 
 static const double RNG_DSCALE = double(1LL << 53);
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -76,17 +76,17 @@ ComputeAccurateDecimalInteger(ExclusiveC
         cstr[i] = c;
     }
     cstr[length] = 0;
 
     char *estr;
     int err = 0;
     *dp = js_strtod_harder(cx->dtoaState(), cstr, &estr, &err);
     if (err == JS_DTOA_ENOMEM) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
 
     return true;
 }
 
 namespace {
 
@@ -674,64 +674,64 @@ Int32ToCString(ToCStringBuf *cbuf, int32
     if (i < 0)
         *--cp = '-';
 
     *len = end - cp.get();
     return cp.get();
 }
 
 template <AllowGC allowGC>
-static JSString * JS_FASTCALL
-js_NumberToStringWithBase(ExclusiveContext *cx, double d, int base);
+static JSString *
+NumberToStringWithBase(ExclusiveContext *cx, double d, int base);
 
 MOZ_ALWAYS_INLINE bool
 num_toString_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsNumber(args.thisv()));
 
     double d = Extract(args.thisv());
 
     int32_t base = 10;
     if (args.hasDefined(0)) {
         double d2;
         if (!ToInteger(cx, args[0], &d2))
             return false;
 
         if (d2 < 2 || d2 > 36) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_RADIX);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_RADIX);
             return false;
         }
 
         base = int32_t(d2);
     }
-    JSString *str = js_NumberToStringWithBase<CanGC>(cx, d, base);
+    JSString *str = NumberToStringWithBase<CanGC>(cx, d, base);
     if (!str) {
         JS_ReportOutOfMemory(cx);
         return false;
     }
     args.rval().setString(str);
     return true;
 }
 
 bool
-js_num_toString(JSContext *cx, unsigned argc, Value *vp)
+js::num_toString(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args);
 }
 
 #if !EXPOSE_INTL_API
 MOZ_ALWAYS_INLINE bool
 num_toLocaleString_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsNumber(args.thisv()));
 
     double d = Extract(args.thisv());
 
-    Rooted<JSString*> str(cx, js_NumberToStringWithBase<CanGC>(cx, d, 10));
+    RootedString str(cx, NumberToStringWithBase<CanGC>(cx, d, 10));
     if (!str) {
         JS_ReportOutOfMemory(cx);
         return false;
     }
 
     /*
      * Create the string, move back to bytes to make string twiddling
      * a bit easier and so we can insert platform charset seperators.
@@ -857,17 +857,17 @@ MOZ_ALWAYS_INLINE bool
 num_valueOf_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsNumber(args.thisv()));
     args.rval().setNumber(Extract(args.thisv()));
     return true;
 }
 
 bool
-js_num_valueOf(JSContext *cx, unsigned argc, Value *vp)
+js::num_valueOf(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_valueOf_impl>(cx, args);
 }
 
 static const unsigned MAX_PRECISION = 100;
 
 static bool
@@ -879,17 +879,17 @@ ComputePrecisionInRange(JSContext *cx, i
         return false;
     if (minPrecision <= prec && prec <= maxPrecision) {
         *precision = int(prec);
         return true;
     }
 
     ToCStringBuf cbuf;
     if (char *numStr = NumberToCString(cx, &cbuf, prec, 10))
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PRECISION_RANGE, numStr);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PRECISION_RANGE, numStr);
     return false;
 }
 
 static bool
 DToStrResult(JSContext *cx, double d, JSDToStrMode mode, int precision, CallArgs args)
 {
     char buf[DTOSTR_VARIABLE_BUFFER_SIZE(MAX_PRECISION + 1)];
     char *numStr = js_dtostr(cx->mainThread().dtoaState, buf, sizeof buf, mode, precision, d);
@@ -960,17 +960,17 @@ num_toExponential(JSContext *cx, unsigne
 MOZ_ALWAYS_INLINE bool
 num_toPrecision_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsNumber(args.thisv()));
 
     double d = Extract(args.thisv());
 
     if (!args.hasDefined(0)) {
-        JSString *str = js_NumberToStringWithBase<CanGC>(cx, d, 10);
+        JSString *str = NumberToStringWithBase<CanGC>(cx, d, 10);
         if (!str) {
             JS_ReportOutOfMemory(cx);
             return false;
         }
         args.rval().setString(str);
         return true;
     }
 
@@ -987,23 +987,23 @@ num_toPrecision(JSContext *cx, unsigned 
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsNumber, num_toPrecision_impl>(cx, args);
 }
 
 static const JSFunctionSpec number_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,       num_toSource,          0, 0),
 #endif
-    JS_FN(js_toString_str,       js_num_toString,       1, 0),
+    JS_FN(js_toString_str,       num_toString,          1, 0),
 #if EXPOSE_INTL_API
     JS_SELF_HOSTED_FN(js_toLocaleString_str, "Number_toLocaleString", 0,0),
 #else
     JS_FN(js_toLocaleString_str, num_toLocaleString,     0,0),
 #endif
-    JS_FN(js_valueOf_str,        js_num_valueOf,        0, 0),
+    JS_FN(js_valueOf_str,        num_valueOf,           0, 0),
     JS_FN("toFixed",             num_toFixed,           1, 0),
     JS_FN("toExponential",       num_toExponential,     1, 0),
     JS_FN("toPrecision",         num_toPrecision,       1, 0),
     JS_FS_END
 };
 
 // ES6 draft ES6 15.7.3.12
 static bool
@@ -1113,17 +1113,17 @@ js::FinishRuntimeNumberState(JSRuntime *
      * strings.
      */
     char *storage = const_cast<char *>(rt->thousandsSeparator);
     js_free(storage);
 }
 #endif
 
 JSObject *
-js_InitNumberClass(JSContext *cx, HandleObject obj)
+js::InitNumberClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->isNative());
 
     /* XXX must do at least once per new thread, so do it per JSContext... */
     FIX_FPU();
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
@@ -1244,18 +1244,18 @@ js::NumberToCString(JSContext *cx, ToCSt
     int32_t i;
     size_t len;
     return mozilla::NumberIsInt32(d, &i)
            ? Int32ToCString(cbuf, i, &len, base)
            : FracNumberToCString(cx, cbuf, d, base);
 }
 
 template <AllowGC allowGC>
-static JSString * JS_FASTCALL
-js_NumberToStringWithBase(ExclusiveContext *cx, double d, int base)
+static JSString *
+NumberToStringWithBase(ExclusiveContext *cx, double d, int base)
 {
     ToCStringBuf cbuf;
     char *numStr;
 
     /*
      * Caller is responsible for error reporting. When called from trace,
      * returning nullptr here will cause us to fall of trace and then retry
      * from the interpreter (which will report the error).
@@ -1284,17 +1284,17 @@ js_NumberToStringWithBase(ExclusiveConte
         numStr = Int32ToCString(&cbuf, i, &len, base);
         MOZ_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize);
     } else {
         if (JSFlatString *str = comp->dtoaCache.lookup(base, d))
             return str;
 
         numStr = FracNumberToCString(cx, &cbuf, d, base);
         if (!numStr) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         MOZ_ASSERT_IF(base == 10,
                       !cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize);
         MOZ_ASSERT_IF(base != 10,
                       cbuf.dbuf && cbuf.dbuf == numStr);
     }
 
@@ -1303,17 +1303,17 @@ js_NumberToStringWithBase(ExclusiveConte
     comp->dtoaCache.cache(base, d, s);
     return s;
 }
 
 template <AllowGC allowGC>
 JSString *
 js::NumberToString(ExclusiveContext *cx, double d)
 {
-    return js_NumberToStringWithBase<allowGC>(cx, d, 10);
+    return NumberToStringWithBase<allowGC>(cx, d, 10);
 }
 
 template JSString *
 js::NumberToString<CanGC>(ExclusiveContext *cx, double d);
 
 template JSString *
 js::NumberToString<NoGC>(ExclusiveContext *cx, double d);
 
@@ -1325,17 +1325,17 @@ js::NumberToAtom(ExclusiveContext *cx, d
         return Int32ToAtom(cx, si);
 
     if (JSFlatString *str = LookupDtoaCache(cx, d))
         return AtomizeString(cx, str);
 
     ToCStringBuf cbuf;
     char *numStr = FracNumberToCString(cx, &cbuf, d);
     if (!numStr) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return nullptr;
     }
     MOZ_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize);
 
     size_t length = strlen(numStr);
     JSAtom *atom = Atomize(cx, numStr, length);
     if (!atom)
         return nullptr;
@@ -1343,17 +1343,17 @@ js::NumberToAtom(ExclusiveContext *cx, d
     CacheNumber(cx, d, atom);
 
     return atom;
 }
 
 JSFlatString *
 js::NumberToString(JSContext *cx, double d)
 {
-    if (JSString *str = js_NumberToStringWithBase<CanGC>(cx, d, 10))
+    if (JSString *str = NumberToStringWithBase<CanGC>(cx, d, 10))
         return &str->asFlat();
     return nullptr;
 }
 
 JSFlatString *
 js::IndexToString(JSContext *cx, uint32_t index)
 {
     if (StaticStrings::hasUint(index))
@@ -1507,17 +1507,17 @@ js::ToNumberSlow(ExclusiveContext *cx, V
                 return true;
             }
             if (v.isNull()) {
                 *out = 0.0;
                 return true;
             }
             if (v.isSymbol()) {
                 if (cx->isJSContext()) {
-                    JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
+                    JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
                                          JSMSG_SYMBOL_TO_NUMBER);
                 }
                 return false;
             }
 
             MOZ_ASSERT(v.isUndefined());
             *out = GenericNaN();
             return true;
--- a/js/src/jsnum.h
+++ b/js/src/jsnum.h
@@ -21,21 +21,21 @@ class StringBuffer;
 extern bool
 InitRuntimeNumberState(JSRuntime *rt);
 
 #if !EXPOSE_INTL_API
 extern void
 FinishRuntimeNumberState(JSRuntime *rt);
 #endif
 
-} /* namespace js */
-
 /* Initialize the Number class, returning its prototype object. */
 extern JSObject *
-js_InitNumberClass(JSContext *cx, js::HandleObject obj);
+InitNumberClass(JSContext *cx, HandleObject obj);
+
+} /* namespace js */
 
 /*
  * String constants for global function names, used in jsapi.c and jsnum.c.
  */
 extern const char js_isNaN_str[];
 extern const char js_isFinite_str[];
 extern const char js_parseFloat_str[];
 extern const char js_parseInt_str[];
@@ -96,17 +96,17 @@ struct ToCStringBuf
     ToCStringBuf();
     ~ToCStringBuf();
 };
 
 /*
  * Convert a number to a C string.  When base==10, this function implements
  * ToString() as specified by ECMA-262-5 section 9.8.1.  It handles integral
  * values cheaply.  Return nullptr if we ran out of memory.  See also
- * js_NumberToCString().
+ * NumberToCString().
  */
 extern char *
 NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, int base = 10);
 
 /*
  * The largest positive integer such that all positive integers less than it
  * may be precisely represented using the IEEE-754 double-precision format.
  */
@@ -182,23 +182,23 @@ num_parseInt(JSContext *cx, unsigned arg
  *
  * Return false if out of memory.
  */
 template <typename CharT>
 extern bool
 js_strtod(js::ExclusiveContext *cx, const CharT *begin, const CharT *end,
           const CharT **dEnd, double *d);
 
-extern bool
-js_num_toString(JSContext *cx, unsigned argc, js::Value *vp);
+namespace js {
 
 extern bool
-js_num_valueOf(JSContext *cx, unsigned argc, js::Value *vp);
+num_toString(JSContext *cx, unsigned argc, Value *vp);
 
-namespace js {
+extern bool
+num_valueOf(JSContext *cx, unsigned argc, Value *vp);
 
 static MOZ_ALWAYS_INLINE bool
 ValueFitsInInt32(const Value &v, int32_t *pi)
 {
     if (v.isInt32()) {
         *pi = v.toInt32();
         return true;
     }
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -70,17 +70,17 @@ using namespace js::gc;
 
 using mozilla::DebugOnly;
 using mozilla::Maybe;
 
 JS_FRIEND_API(JSObject *)
 JS_ObjectToInnerObject(JSContext *cx, HandleObject obj)
 {
     if (!obj) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INACTIVE);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INACTIVE);
         return nullptr;
     }
     return GetInnerObject(obj);
 }
 
 JS_FRIEND_API(JSObject *)
 JS_ObjectToOuterObject(JSContext *cx, HandleObject obj)
 {
@@ -91,17 +91,17 @@ JS_ObjectToOuterObject(JSContext *cx, Ha
 JSObject *
 js::NonNullObject(JSContext *cx, const Value &v)
 {
     if (v.isPrimitive()) {
         RootedValue value(cx, v);
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, NullPtr());
         if (!bytes)
             return nullptr;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
         return nullptr;
     }
     return &v.toObject();
 }
 
 const char *
 js::InformalValueTypeName(const Value &v)
 {
@@ -236,27 +236,27 @@ PropDesc::makeObject(JSContext *cx, Muta
     return true;
 }
 
 bool
 js::GetFirstArgumentAsObject(JSContext *cx, const CallArgs &args, const char *method,
                              MutableHandleObject objp)
 {
     if (args.length() == 0) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              method, "0", "s");
         return false;
     }
 
     HandleValue v = args[0];
     if (!v.isObject()) {
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
         if (!bytes)
             return false;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
                              bytes, "not an object");
         js_free(bytes);
         return false;
     }
 
     objp.set(&v.toObject());
     return true;
 }
@@ -282,17 +282,17 @@ PropDesc::initialize(JSContext *cx, cons
 
     RootedValue v(cx, origval);
 
     /* 8.10.5 step 1 */
     if (v.isPrimitive()) {
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr());
         if (!bytes)
             return false;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
         return false;
     }
     RootedObject desc(cx, &v.toObject());
 
     isUndefined_ = false;
 
     /*
      * Start with the proper defaults.  XXX shouldn't be necessary when we get
@@ -365,17 +365,17 @@ PropDesc::initialize(JSContext *cx, cons
         attrs |= JSPROP_SETTER | JSPROP_SHARED;
         attrs &= ~JSPROP_READONLY;
         if (checkAccessors && !checkSetter(cx))
             return false;
     }
 
     /* 8.10.7 step 9 */
     if ((hasGet() || hasSet()) && (hasValue() || hasWritable())) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_DESCRIPTOR);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_DESCRIPTOR);
         return false;
     }
 
     MOZ_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER)));
 
     return true;
 }
 
@@ -420,31 +420,31 @@ js::Throw(JSContext *cx, jsid id, unsign
 
     RootedValue idVal(cx, IdToValue(id));
     JSString *idstr = ValueToSource(cx, idVal);
     if (!idstr)
        return false;
     JSAutoByteString bytes(cx, idstr);
     if (!bytes)
         return false;
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber, bytes.ptr());
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNumber, bytes.ptr());
     return false;
 }
 
 bool
 js::Throw(JSContext *cx, JSObject *obj, unsigned errorNumber)
 {
     if (js_ErrorFormatString[errorNumber].argCount == 1) {
         RootedValue val(cx, ObjectValue(*obj));
-        js_ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,
-                                 JSDVG_IGNORE_STACK, val, NullPtr(),
-                                 nullptr, nullptr);
+        ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber,
+                              JSDVG_IGNORE_STACK, val, NullPtr(),
+                              nullptr, nullptr);
     } else {
         MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount == 0);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, errorNumber);
     }
     return false;
 }
 
 static bool
 Reject(JSContext *cx, unsigned errorNumber, bool throwError, jsid id, bool *rval)
 {
     if (throwError)
@@ -819,17 +819,17 @@ DefinePropertyOnArray(JSContext *cx, Han
                 attrs = attrs | JSPROP_READONLY;
         }
 
         return ArraySetLength(cx, arr, id, attrs, v, throwError);
     }
 
     /* Step 3. */
     uint32_t index;
-    if (js_IdIsIndex(id, &index)) {
+    if (IdIsIndex(id, &index)) {
         /* Step 3b. */
         uint32_t oldLen = arr->length();
 
         /* Steps 3a, 3e. */
         if (index >= oldLen && !arr->lengthIsWritable())
             return Reject(cx, arr, JSMSG_CANT_APPEND_TO_ARRAY, throwError, rval);
 
         /* Steps 3f-j. */
@@ -988,17 +988,17 @@ js::SetIntegrityLevel(JSContext *cx, Han
 {
     assertSameCompartment(cx, obj);
 
     // Steps 3-5. (Steps 1-2 are redundant assertions.)
     bool status;
     if (!PreventExtensions(cx, obj, &status))
         return false;
     if (!status) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY);
         return false;
     }
 
     // Steps 6-7.
     AutoIdVector keys(cx);
     if (!GetPropertyKeys(cx, obj, JSITER_HIDDEN | JSITER_OWNONLY | JSITER_SYMBOLS, &keys))
         return false;
 
@@ -1775,29 +1775,29 @@ CopyProxyObject(JSContext *cx, Handle<Pr
 
     return true;
 }
 
 JSObject *
 js::CloneObject(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto)
 {
     if (!obj->isNative() && !obj->is<ProxyObject>()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_CANT_CLONE_OBJECT);
         return nullptr;
     }
 
     RootedObject clone(cx);
     if (obj->isNative()) {
         clone = NewObjectWithGivenTaggedProto(cx, obj->getClass(), proto, NullPtr());
         if (!clone)
             return nullptr;
 
         if (clone->is<JSFunction>() && (obj->compartment() != clone->compartment())) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                  JSMSG_CANT_CLONE_OBJECT);
             return nullptr;
         }
 
         if (obj->as<NativeObject>().hasPrivate())
             clone->as<NativeObject>().setPrivate(obj->as<NativeObject>().getPrivate());
     } else {
         ProxyOptions options;
@@ -2485,17 +2485,17 @@ DefineConstructorAndPrototype(JSContext 
      *
      * FIXME: lazy standard (built-in) class initialization and even older
      * eager boostrapping code rely on all of these properties:
      *
      * 1. NewObject attempting to compute a default prototype object when
      *    passed null for proto; and
      *
      * 2. NewObject tolerating no default prototype (null proto slot value)
-     *    due to this js_InitClass call coming from js_InitFunctionClass on an
+     *    due to this js::InitClass call coming from js::InitFunctionClass on an
      *    otherwise-uninitialized global.
      *
      * 3. NewObject allocating a JSFunction-sized GC-thing when clasp is
      *    &JSFunction::class_, not a JSObject-sized (smaller) GC-thing.
      *
      * The JS_NewObjectForGivenProto and JS_NewObject APIs also allow clasp to
      * be &JSFunction::class_ (we could break compatibility easily). But
      * fixing (3) is not enough without addressing the bootstrapping dependency
@@ -2598,21 +2598,21 @@ bad:
         DeleteProperty(cx, obj, id, &succeeded);
     }
     if (cached)
         ClearClassObject(obj, key);
     return nullptr;
 }
 
 NativeObject *
-js_InitClass(JSContext *cx, HandleObject obj, HandleObject protoProto_,
-             const Class *clasp, Native constructor, unsigned nargs,
-             const JSPropertySpec *ps, const JSFunctionSpec *fs,
-             const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
-             NativeObject **ctorp, AllocKind ctorKind)
+js::InitClass(JSContext *cx, HandleObject obj, HandleObject protoProto_,
+              const Class *clasp, Native constructor, unsigned nargs,
+              const JSPropertySpec *ps, const JSFunctionSpec *fs,
+              const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
+              NativeObject **ctorp, AllocKind ctorKind)
 {
     RootedObject protoProto(cx, protoProto_);
 
     /* Check function pointer members. */
     MOZ_ASSERT(clasp->addProperty != JS_PropertyStub);
     MOZ_ASSERT(clasp->getProperty != JS_PropertyStub);
     MOZ_ASSERT(clasp->setProperty != JS_StrictPropertyStub);
 
@@ -2622,17 +2622,17 @@ js_InitClass(JSContext *cx, HandleObject
 
     /*
      * All instances of the class will inherit properties from the prototype
      * object we are about to create (in DefineConstructorAndPrototype), which
      * in turn will inherit from protoProto.
      *
      * When initializing a standard class (other than Object), if protoProto is
      * null, default to Object.prototype. The engine's internal uses of
-     * js_InitClass depend on this nicety.
+     * js::InitClass depend on this nicety.
      */
     JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
     if (key != JSProto_Null &&
         !protoProto &&
         !GetBuiltinPrototype(cx, JSProto_Object, &protoProto))
     {
         return nullptr;
     }
@@ -3080,37 +3080,37 @@ js::GetPropertyPure(ExclusiveContext *cx
         return false;
     return pobj->isNative() && NativeGetPureInline(&pobj->as<NativeObject>(), shape, vp);
 }
 
 bool
 JSObject::reportReadOnly(JSContext *cx, jsid id, unsigned report)
 {
     RootedValue val(cx, IdToValue(id));
-    return js_ReportValueErrorFlags(cx, report, JSMSG_READ_ONLY,
-                                    JSDVG_IGNORE_STACK, val, js::NullPtr(),
-                                    nullptr, nullptr);
+    return ReportValueErrorFlags(cx, report, JSMSG_READ_ONLY,
+                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 nullptr, nullptr);
 }
 
 bool
 JSObject::reportNotConfigurable(JSContext *cx, jsid id, unsigned report)
 {
     RootedValue val(cx, IdToValue(id));
-    return js_ReportValueErrorFlags(cx, report, JSMSG_CANT_DELETE,
-                                    JSDVG_IGNORE_STACK, val, js::NullPtr(),
-                                    nullptr, nullptr);
+    return ReportValueErrorFlags(cx, report, JSMSG_CANT_DELETE,
+                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 nullptr, nullptr);
 }
 
 bool
 JSObject::reportNotExtensible(JSContext *cx, unsigned report)
 {
     RootedValue val(cx, ObjectValue(*this));
-    return js_ReportValueErrorFlags(cx, report, JSMSG_OBJECT_NOT_EXTENSIBLE,
-                                    JSDVG_IGNORE_STACK, val, js::NullPtr(),
-                                    nullptr, nullptr);
+    return ReportValueErrorFlags(cx, report, JSMSG_OBJECT_NOT_EXTENSIBLE,
+                                 JSDVG_IGNORE_STACK, val, js::NullPtr(),
+                                 nullptr, nullptr);
 }
 
 
 /*** ES6 standard internal methods ***************************************************************/
 
 bool
 js::SetPrototype(JSContext *cx, HandleObject obj, HandleObject proto, bool *succeeded)
 {
@@ -3132,36 +3132,36 @@ js::SetPrototype(JSContext *cx, HandleOb
     }
 
     /*
      * Disallow mutating the [[Prototype]] on ArrayBuffer objects, which
      * due to their complicated delegate-object shenanigans can't easily
      * have a mutable [[Prototype]].
      */
     if (obj->is<ArrayBufferObject>()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
                              "incompatible ArrayBuffer");
         return false;
     }
 
     /*
      * Disallow mutating the [[Prototype]] on Typed Objects, per the spec.
      */
     if (obj->is<TypedObject>()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
                              "incompatible TypedObject");
         return false;
     }
 
     /*
      * Explicitly disallow mutating the [[Prototype]] of Location objects
      * for flash-related security reasons.
      */
     if (!strcmp(obj->getClass()->name, "Location")) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
                              "incompatible Location object");
         return false;
     }
 
     /* ES6 9.1.2 step 5 forbids changing [[Prototype]] if not [[Extensible]]. */
     bool extensible;
     if (!IsExtensible(cx, obj, &extensible))
         return false;
@@ -3370,17 +3370,17 @@ js::WatchGuts(JSContext *cx, JS::HandleO
 
         MarkTypePropertyNonData(cx, obj, id);
     }
 
     WatchpointMap *wpmap = cx->compartment()->watchpointMap;
     if (!wpmap) {
         wpmap = cx->runtime()->new_<WatchpointMap>();
         if (!wpmap || !wpmap->init()) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
         cx->compartment()->watchpointMap = wpmap;
     }
 
     return wpmap->watch(cx, obj, id, js::WatchHandler, callable);
 }
 
@@ -3397,17 +3397,17 @@ js::UnwatchGuts(JSContext *cx, JS::Handl
 
 bool
 js::WatchProperty(JSContext *cx, HandleObject obj, HandleId id, HandleObject callable)
 {
     if (WatchOp op = obj->getOps()->watch)
         return op(cx, obj, id, callable);
 
     if (!obj->isNative() || IsAnyTypedArray(obj)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
                              obj->getClass()->name);
         return false;
     }
 
     return WatchGuts(cx, obj, id, callable);
 }
 
 bool
@@ -3490,17 +3490,17 @@ JS::OrdinaryToPrimitive(JSContext *cx, H
 
     const Class *clasp = obj->getClass();
     if (hint == JSTYPE_STRING) {
         id = NameToId(cx->names().toString);
 
         /* Optimize (new String(...)).toString(). */
         if (clasp == &StringObject::class_) {
             StringObject *nobj = &obj->as<StringObject>();
-            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
+            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
                 vp.setString(nobj->unbox());
                 return true;
             }
         }
 
         if (!MaybeCallMethod(cx, obj, id, vp))
             return false;
         if (vp.isPrimitive())
@@ -3512,27 +3512,27 @@ JS::OrdinaryToPrimitive(JSContext *cx, H
         if (vp.isPrimitive())
             return true;
     } else {
 
         /* Optimize new String(...).valueOf(). */
         if (clasp == &StringObject::class_) {
             id = NameToId(cx->names().valueOf);
             StringObject *nobj = &obj->as<StringObject>();
-            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
+            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
                 vp.setString(nobj->unbox());
                 return true;
             }
         }
 
         /* Optimize new Number(...).valueOf(). */
         if (clasp == &NumberObject::class_) {
             id = NameToId(cx->names().valueOf);
             NumberObject *nobj = &obj->as<NumberObject>();
-            if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, js_num_valueOf)) {
+            if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, num_valueOf)) {
                 vp.setNumber(nobj->unbox());
                 return true;
             }
         }
 
         id = NameToId(cx->names().valueOf);
         if (!MaybeCallMethod(cx, obj, id, vp))
             return false;
@@ -3541,31 +3541,31 @@ JS::OrdinaryToPrimitive(JSContext *cx, H
 
         id = NameToId(cx->names().toString);
         if (!MaybeCallMethod(cx, obj, id, vp))
             return false;
         if (vp.isPrimitive())
             return true;
     }
 
-    /* Avoid recursive death when decompiling in js_ReportValueError. */
+    /* Avoid recursive death when decompiling in ReportValueError. */
     RootedString str(cx);
     if (hint == JSTYPE_STRING) {
         str = JS_InternString(cx, clasp->name);
         if (!str)
             return false;
     } else {
         str = nullptr;
     }
 
     RootedValue val(cx, ObjectValue(*obj));
-    js_ReportValueError2(cx, JSMSG_CANT_CONVERT_TO, JSDVG_SEARCH_STACK, val, str,
-                         hint == JSTYPE_VOID
-                         ? "primitive type"
-                         : hint == JSTYPE_STRING ? "string" : "number");
+    ReportValueError2(cx, JSMSG_CANT_CONVERT_TO, JSDVG_SEARCH_STACK, val, str,
+                      hint == JSTYPE_VOID
+                      ? "primitive type"
+                      : hint == JSTYPE_STRING ? "string" : "number");
     return false;
 }
 
 bool
 js::IsDelegate(JSContext *cx, HandleObject obj, const js::Value &v, bool *result)
 {
     if (v.isPrimitive()) {
         *result = false;
@@ -3633,31 +3633,31 @@ js::PrimitiveToObject(JSContext *cx, con
 JSObject *
 js::ToObjectSlow(JSContext *cx, JS::HandleValue val, bool reportScanStack)
 {
     MOZ_ASSERT(!val.isMagic());
     MOZ_ASSERT(!val.isObject());
 
     if (val.isNullOrUndefined()) {
         if (reportScanStack) {
-            js_ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
+            ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, NullPtr());
         } else {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                                  val.isNull() ? "null" : "undefined", "object");
         }
         return nullptr;
     }
 
     return PrimitiveToObject(cx, val);
 }
 
 void
-js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
+js::GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
 {
-    MOZ_ASSERT(trc->debugPrinter() == js_GetObjectSlotName);
+    MOZ_ASSERT(trc->debugPrinter() == GetObjectSlotName);
 
     JSObject *obj = (JSObject *)trc->debugPrintArg();
     uint32_t slot = uint32_t(trc->debugPrintIndex());
 
     Shape *shape;
     if (obj->isNative()) {
         shape = obj->lastProperty();
         while (shape && (!shape->hasSlot() || shape->slot() != slot))
@@ -3713,23 +3713,23 @@ js_GetObjectSlotName(JSTracer *trc, char
             JS_snprintf(buf, bufsize, "**SYMBOL KEY**");
         } else {
             JS_snprintf(buf, bufsize, "**FINALIZED ATOM KEY**");
         }
     }
 }
 
 bool
-js_ReportGetterOnlyAssignment(JSContext *cx, bool strict)
+js::ReportGetterOnlyAssignment(JSContext *cx, bool strict)
 {
     return JS_ReportErrorFlagsAndNumber(cx,
                                         strict
                                         ? JSREPORT_ERROR
                                         : JSREPORT_WARNING | JSREPORT_STRICT,
-                                        js_GetErrorMessage, nullptr,
+                                        GetErrorMessage, nullptr,
                                         JSMSG_GETTER_ONLY);
 }
 
 
 /*** Debugging routines **************************************************************************/
 
 #ifdef DEBUG
 
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1182,21 +1182,20 @@ LookupNameWithGlobalDefault(JSContext *c
  * Additionally, pobjp is not needed by callers so it is not returned.
  */
 extern bool
 LookupNameUnqualified(JSContext *cx, HandlePropertyName name, HandleObject scopeChain,
                       MutableHandleObject objp);
 
 }
 
-extern JSObject *
-js_FindVariableScope(JSContext *cx, JSFunction **funp);
+namespace js {
 
-
-namespace js {
+extern JSObject *
+FindVariableScope(JSContext *cx, JSFunction **funp);
 
 bool
 LookupPropertyPure(ExclusiveContext *cx, JSObject *obj, jsid id, JSObject **objp,
                    Shape **propp);
 
 bool
 GetPropertyPure(ExclusiveContext *cx, JSObject *obj, jsid id, Value *vp);
 
@@ -1237,26 +1236,21 @@ ToObjectFromStack(JSContext *cx, HandleV
 
 template<XDRMode mode>
 bool
 XDRObjectLiteral(XDRState<mode> *xdr, MutableHandleNativeObject obj);
 
 extern JSObject *
 CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj);
 
-} /* namespace js */
-
 extern void
-js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
+GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
 
 extern bool
-js_ReportGetterOnlyAssignment(JSContext *cx, bool strict);
-
-
-namespace js {
+ReportGetterOnlyAssignment(JSContext *cx, bool strict);
 
 extern JSObject *
 NonNullObject(JSContext *cx, const Value &v);
 
 extern const char *
 InformalValueTypeName(const Value &v);
 
 extern bool
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -408,27 +408,27 @@ ToPrimitive(JSContext *cx, MutableHandle
         return true;
 
     JSObject *obj = &vp.toObject();
 
     /* Optimize new String(...).valueOf(). */
     if (obj->is<StringObject>()) {
         jsid id = NameToId(cx->names().valueOf);
         StringObject *nobj = &obj->as<StringObject>();
-        if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
+        if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
             vp.setString(nobj->unbox());
             return true;
         }
     }
 
     /* Optimize new Number(...).valueOf(). */
     if (obj->is<NumberObject>()) {
         jsid id = NameToId(cx->names().valueOf);
         NumberObject *nobj = &obj->as<NumberObject>();
-        if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, js_num_valueOf)) {
+        if (ClassMethodIsNative(cx, nobj, &NumberObject::class_, id, num_valueOf)) {
             vp.setNumber(nobj->unbox());
             return true;
         }
     }
 
     RootedObject objRoot(cx, obj);
     return ToPrimitive(cx, objRoot, JSTYPE_VOID, vp);
 }
@@ -779,19 +779,19 @@ ApplyAttributes(unsigned attrs, bool enu
         if (!configurable)
             attrs |= JSPROP_PERMANENT;
         else
             attrs &= ~JSPROP_PERMANENT;
     }
     return attrs;
 }
 
+extern NativeObject *
+InitClass(JSContext *cx, HandleObject obj, HandleObject parent_proto,
+          const Class *clasp, JSNative constructor, unsigned nargs,
+          const JSPropertySpec *ps, const JSFunctionSpec *fs,
+          const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
+          NativeObject **ctorp = nullptr,
+          gc::AllocKind ctorKind = JSFunction::FinalizeKind);
+
 } /* namespace js */
 
-extern js::NativeObject *
-js_InitClass(JSContext *cx, js::HandleObject obj, js::HandleObject parent_proto,
-             const js::Class *clasp, JSNative constructor, unsigned nargs,
-             const JSPropertySpec *ps, const JSFunctionSpec *fs,
-             const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
-             js::NativeObject **ctorp = nullptr,
-             js::gc::AllocKind ctorKind = JSFunction::FinalizeKind);
-
 #endif /* jsobjinlines_h */
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -304,17 +304,17 @@ JO(JSContext *cx, HandleObject obj, Stri
      *     (and in JA as well).
      */
 
     /* Steps 1-2, 11. */
     AutoCycleDetector detect(cx, obj);
     if (!detect.init())
         return false;
     if (detect.foundCycle()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
                              js_object_str);
         return false;
     }
 
     if (!scx->sb.append('{'))
         return false;
 
     /* Steps 5-7. */
@@ -395,17 +395,17 @@ JA(JSContext *cx, HandleObject obj, Stri
      *     (and in JO as well).
      */
 
     /* Steps 1-2, 11. */
     AutoCycleDetector detect(cx, obj);
     if (!detect.init())
         return false;
     if (detect.foundCycle()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_JSON_CYCLIC_VALUE,
                              js_object_str);
         return false;
     }
 
     if (!scx->sb.append('['))
         return false;
 
     /* Step 6. */
@@ -512,18 +512,18 @@ Str(JSContext *cx, const Value &v, Strin
         ok = JO(cx, obj, scx);
     scx->depth--;
 
     return ok;
 }
 
 /* ES5 15.12.3. */
 bool
-js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value space_,
-             StringBuffer &sb)
+js::Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value space_,
+              StringBuffer &sb)
 {
     RootedObject replacer(cx, replacer_);
     RootedValue space(cx, space_);
 
     /* Step 4. */
     AutoIdVector propertyList(cx);
     if (replacer) {
         if (replacer->isCallable()) {
@@ -856,17 +856,17 @@ bool
 json_stringify(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject replacer(cx, args.get(1).isObject() ? &args[1].toObject() : nullptr);
     RootedValue value(cx, args.get(0));
     RootedValue space(cx, args.get(2));
 
     StringBuffer sb(cx);
-    if (!js_Stringify(cx, &value, replacer, space, sb))
+    if (!Stringify(cx, &value, replacer, space, sb))
         return false;
 
     // XXX This can never happen to nsJSON.cpp, but the JSON object
     // needs to support returning undefined. So this is a little awkward
     // for the API, because we want to support streaming writers.
     if (!sb.empty()) {
         JSString *str = sb.finishString();
         if (!str)
@@ -884,17 +884,17 @@ static const JSFunctionSpec json_static_
     JS_FN(js_toSource_str,  json_toSource,      0, 0),
 #endif
     JS_FN("parse",          json_parse,         2, 0),
     JS_FN("stringify",      json_stringify,     3, 0),
     JS_FS_END
 };
 
 JSObject *
-js_InitJSONClass(JSContext *cx, HandleObject obj)
+js::InitJSONClass(JSContext *cx, HandleObject obj)
 {
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     RootedObject proto(cx, global->getOrCreateObjectPrototype(cx));
     if (!proto)
         return nullptr;
     RootedObject JSON(cx, NewObjectWithGivenProto(cx, &JSONClass, proto, global, SingletonObject));
     if (!JSON)
--- a/js/src/json.h
+++ b/js/src/json.h
@@ -10,26 +10,23 @@
 #include "mozilla/Range.h"
 
 #include "NamespaceImports.h"
 
 #include "js/RootingAPI.h"
 
 namespace js {
 class StringBuffer;
-}
 
 extern JSObject *
-js_InitJSONClass(JSContext *cx, js::HandleObject obj);
+InitJSONClass(JSContext *cx, HandleObject obj);
 
 extern bool
-js_Stringify(JSContext *cx, js::MutableHandleValue vp, JSObject *replacer,
-             js::Value space, js::StringBuffer &sb);
-
-namespace js {
+Stringify(JSContext *cx, js::MutableHandleValue vp, JSObject *replacer,
+          Value space, StringBuffer &sb);
 
 template <typename CharT>
 extern bool
 ParseJSONWithReviver(JSContext *cx, const mozilla::Range<const CharT> chars,
                      HandleValue reviver, MutableHandleValue vp);
 
 } // namespace js
 
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -68,31 +68,31 @@ const unsigned js_NumCodeSpecs = JS_ARRA
  */
 static const char * const CodeToken[] = {
 #define TOKEN(op, val, name, token, ...)  token,
     FOR_EACH_OPCODE(TOKEN)
 #undef TOKEN
 };
 
 /*
- * Array of JS bytecode names used by PC count JSON, DEBUG-only js_Disassemble
+ * Array of JS bytecode names used by PC count JSON, DEBUG-only Disassemble
  * and JIT debug spew.
  */
 const char * const js_CodeName[] = {
 #define OPNAME(op, val, name, ...)  name,
     FOR_EACH_OPCODE(OPNAME)
 #undef OPNAME
 };
 
 /************************************************************************/
 
 #define COUNTS_LEN 16
 
 size_t
-js_GetVariableBytecodeLength(jsbytecode *pc)
+js::GetVariableBytecodeLength(jsbytecode *pc)
 {
     JSOp op = JSOp(*pc);
     MOZ_ASSERT(js_CodeSpec[op].length == -1);
     switch (op) {
       case JSOP_TABLESWITCH: {
         /* Structure: default-jump case-low case-high case1-jump ... */
         pc += JUMP_OFFSET_LEN;
         int32_t low = GET_JUMP_OFFSET(pc);
@@ -230,27 +230,27 @@ js::DumpIonScriptCounts(Sprinter *sp, ji
         for (size_t j = 0; j < block.numSuccessors(); j++)
             Sprint(sp, " -> #%lu", block.successor(j));
         Sprint(sp, " :: %llu hits\n", block.hitCount());
         Sprint(sp, "%s\n", block.code());
     }
 }
 
 void
-js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
+js::DumpPCCounts(JSContext *cx, HandleScript script, Sprinter *sp)
 {
     MOZ_ASSERT(script->hasScriptCounts());
 
 #ifdef DEBUG
     jsbytecode *pc = script->code();
     while (pc < script->codeEnd()) {
         JSOp op = JSOp(*pc);
         jsbytecode *next = GetNextPc(pc);
 
-        if (!js_Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
+        if (!Disassemble1(cx, script, pc, script->pcToOffset(pc), true, sp))
             return;
 
         size_t total = PCCounts::numCounts(op);
         double *raw = script->getPCCounts(pc).rawCounts();
 
         Sprint(sp, "                  {");
         bool printed = false;
         for (size_t i = 0; i < total; i++) {
@@ -285,17 +285,17 @@ js::DumpCompartmentPCCounts(JSContext *c
             continue;
 
         if (script->hasScriptCounts()) {
             Sprinter sprinter(cx);
             if (!sprinter.init())
                 return;
 
             fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
-            js_DumpPCCounts(cx, script, &sprinter);
+            DumpPCCounts(cx, script, &sprinter);
             fputs(sprinter.string(), stdout);
             fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
         }
     }
 
     for (unsigned thingKind = FINALIZE_OBJECT0; thingKind < FINALIZE_OBJECT_LIMIT; thingKind++) {
         for (ZoneCellIter i(cx->zone(), (AllocKind) thingKind); !i.done(); i.next()) {
             JSObject *obj = i.get<JSObject>();
@@ -420,17 +420,17 @@ class BytecodeParser
 
   private:
     LifoAlloc &alloc() {
         return allocScope_.alloc();
     }
 
     void reportOOM() {
         allocScope_.releaseEarly();
-        js_ReportOutOfMemory(cx_);
+        ReportOutOfMemory(cx_);
     }
 
     uint32_t numSlots() {
         return 1 + script_->nfixed() +
                (script_->functionNonDelazifying() ? script_->functionNonDelazifying()->nargs() : 0);
     }
 
     uint32_t maximumStackDepth() {
@@ -712,19 +712,19 @@ js::ReconstructStackDepth(JSContext *cx,
     return true;
 }
 
 /*
  * If pc != nullptr, include a prefix indicating whether the PC is at the
  * current line. If showAll is true, include the source note type and the
  * entry stack depth.
  */
-JS_FRIEND_API(bool)
-js_DisassembleAtPC(JSContext *cx, JSScript *scriptArg, bool lines,
-                   jsbytecode *pc, bool showAll, Sprinter *sp)
+static bool
+DisassembleAtPC(JSContext *cx, JSScript *scriptArg, bool lines,
+                jsbytecode *pc, bool showAll, Sprinter *sp)
 {
     RootedScript script(cx, scriptArg);
     BytecodeParser parser(cx, script);
 
     jsbytecode *next, *end;
     unsigned len;
 
     if (showAll && !parser.parse())
@@ -758,17 +758,17 @@ js_DisassembleAtPC(JSContext *cx, JSScri
             sp->put("main:\n");
         if (pc != nullptr) {
             if (pc == next)
                 sp->put("--> ");
             else
                 sp->put("    ");
         }
         if (showAll) {
-            jssrcnote *sn = js_GetSrcNote(cx, script, next);
+            jssrcnote *sn = GetSrcNote(cx, script, next);
             if (sn) {
                 MOZ_ASSERT(!SN_IS_TERMINATOR(sn));
                 jssrcnote *next = SN_NEXT(sn);
                 while (!SN_IS_TERMINATOR(next) && SN_DELTA(next) == 0) {
                     Sprint(sp, "%02u\n    ", SN_TYPE(sn));
                     sn = next;
                     next = SN_NEXT(sn);
                 }
@@ -776,75 +776,28 @@ js_DisassembleAtPC(JSContext *cx, JSScri
             }
             else
                 sp->put("   ");
             if (parser.isReachable(next))
                 Sprint(sp, "%05u ", parser.stackDepthAtPC(next));
             else
                 Sprint(sp, "      ");
         }
-        len = js_Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
+        len = Disassemble1(cx, script, next, script->pcToOffset(next), lines, sp);
         if (!len)
             return false;
         next += len;
     }
     return true;
 }
 
 bool
-js_Disassemble(JSContext *cx, HandleScript script, bool lines, Sprinter *sp)
-{
-    return js_DisassembleAtPC(cx, script, lines, nullptr, false, sp);
-}
-
-JS_FRIEND_API(bool)
-js_DumpPC(JSContext *cx)
+js::Disassemble(JSContext *cx, HandleScript script, bool lines, Sprinter *sp)
 {
-    js::gc::AutoSuppressGC suppressGC(cx);
-    Sprinter sprinter(cx);
-    if (!sprinter.init())
-        return false;
-    ScriptFrameIter iter(cx);
-    if (iter.done()) {
-        fprintf(stdout, "Empty stack.\n");
-        return true;
-    }
-    RootedScript script(cx, iter.script());
-    bool ok = js_DisassembleAtPC(cx, script, true, iter.pc(), false, &sprinter);
-    fprintf(stdout, "%s", sprinter.string());
-    return ok;
-}
-
-JS_FRIEND_API(bool)
-js_DumpScript(JSContext *cx, JSScript *scriptArg)
-{
-    js::gc::AutoSuppressGC suppressGC(cx);
-    Sprinter sprinter(cx);
-    if (!sprinter.init())
-        return false;
-    RootedScript script(cx, scriptArg);
-    bool ok = js_Disassemble(cx, script, true, &sprinter);
-    fprintf(stdout, "%s", sprinter.string());
-    return ok;
-}
-
-/*
- * Useful to debug ReconstructPCStack.
- */
-JS_FRIEND_API(bool)
-js_DumpScriptDepth(JSContext *cx, JSScript *scriptArg, jsbytecode *pc)
-{
-    js::gc::AutoSuppressGC suppressGC(cx);
-    Sprinter sprinter(cx);
-    if (!sprinter.init())
-        return false;
-    RootedScript script(cx, scriptArg);
-    bool ok = js_DisassembleAtPC(cx, script, true, pc, true, &sprinter);
-    fprintf(stdout, "%s", sprinter.string());
-    return ok;
+    return DisassembleAtPC(cx, script, lines, nullptr, false, sp);
 }
 
 static char *
 QuoteString(Sprinter *sp, JSString *str, char16_t quote);
 
 static bool
 ToDisassemblySource(JSContext *cx, HandleValue v, JSAutoByteString *bytes)
 {
@@ -918,29 +871,29 @@ ToDisassemblySource(JSContext *cx, Handl
         if (obj.is<RegExpObject>()) {
             JSString *source = obj.as<RegExpObject>().toString(cx);
             if (!source)
                 return false;
             return bytes->encodeLatin1(cx, source);
         }
     }
 
-    return !!js_ValueToPrintable(cx, v, bytes, true);
+    return !!ValueToPrintable(cx, v, bytes, true);
 }
 
 unsigned
-js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
-                unsigned loc, bool lines, Sprinter *sp)
+js::Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc,
+                 unsigned loc, bool lines, Sprinter *sp)
 {
     JSOp op = (JSOp)*pc;
     if (op >= JSOP_LIMIT) {
         char numBuf1[12], numBuf2[12];
         JS_snprintf(numBuf1, sizeof numBuf1, "%d", op);
         JS_snprintf(numBuf2, sizeof numBuf2, "%d", JSOP_LIMIT);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_BYTECODE_TOO_BIG, numBuf1, numBuf2);
         return 0;
     }
     const JSCodeSpec *cs = &js_CodeSpec[op];
     ptrdiff_t len = (ptrdiff_t) cs->length;
     Sprint(sp, "%05u:", loc);
     if (lines)
         Sprint(sp, "%4u", PCToLineNumber(script, pc));
@@ -1084,17 +1037,17 @@ js_Disassemble1(JSContext *cx, HandleScr
       print_int:
         Sprint(sp, " %d", i);
         break;
       }
 
       default: {
         char numBuf[12];
         JS_snprintf(numBuf, sizeof numBuf, "%lx", (unsigned long) cs->format);
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_UNKNOWN_FORMAT, numBuf);
         return 0;
       }
     }
     sp->put("\n");
     return len;
 }
 
@@ -1290,17 +1243,17 @@ Sprinter::getOffset() const
 }
 
 void
 Sprinter::reportOutOfMemory()
 {
     if (reportedOOM)
         return;
     if (context)
-        js_ReportOutOfMemory(context);
+        ReportOutOfMemory(context);
     reportedOOM = true;
 }
 
 bool
 Sprinter::hadOutOfMemory() const
 {
     return reportedOOM;
 }
@@ -1412,17 +1365,17 @@ QuoteString(Sprinter *sp, JSString *str,
 
     AutoCheckCannotGC nogc;
     return linear->hasLatin1Chars()
            ? QuoteString(sp, linear->latin1Chars(nogc), linear->length(), quote)
            : QuoteString(sp, linear->twoByteChars(nogc), linear->length(), quote);
 }
 
 JSString *
-js_QuoteString(ExclusiveContext *cx, JSString *str, char16_t quote)
+js::QuoteString(ExclusiveContext *cx, JSString *str, char16_t quote)
 {
     Sprinter sprinter(cx);
     if (!sprinter.init())
         return nullptr;
     char *bytes = QuoteString(&sprinter, str, quote);
     if (!bytes)
         return nullptr;
     return NewStringCopyZ<CanGC>(cx, bytes);
@@ -1504,17 +1457,17 @@ ExpressionDecompiler::decompilePC(jsbyte
     MOZ_ASSERT(script->containsPC(pc));
 
     JSOp op = (JSOp)*pc;
 
     if (const char *token = CodeToken[op]) {
         // Handle simple cases of binary and unary operators.
         switch (js_CodeSpec[op].nuses) {
           case 2: {
-            jssrcnote *sn = js_GetSrcNote(cx, script, pc);
+            jssrcnote *sn = GetSrcNote(cx, script, pc);
             if (!sn || SN_TYPE(sn) != SRC_ASSIGNOP)
                 return write("(") &&
                        decompilePCForStackOperand(pc, -2) &&
                        write(" ") &&
                        write(token) &&
                        write(" ") &&
                        decompilePCForStackOperand(pc, -1) &&
                        write(")");
@@ -2121,17 +2074,17 @@ AppendArrayJSONProperties(JSContext *cx,
 }
 
 JS_FRIEND_API(JSString *)
 js::GetPCCountScriptSummary(JSContext *cx, size_t index)
 {
     JSRuntime *rt = cx->runtime();
 
     if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
         return nullptr;
     }
 
     const ScriptAndCounts &sac = (*rt->scriptAndCountsVector)[index];
     RootedScript script(cx, sac.script);
 
     /*
      * OOM on buffer appends here will not be caught immediately, but since
@@ -2374,17 +2327,17 @@ GetPCCountJSON(JSContext *cx, const Scri
 }
 
 JS_FRIEND_API(JSString *)
 js::GetPCCountScriptContents(JSContext *cx, size_t index)
 {
     JSRuntime *rt = cx->runtime();
 
     if (!rt->scriptAndCountsVector || index >= rt->scriptAndCountsVector->length()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
         return nullptr;
     }
 
     const ScriptAndCounts &sac = (*rt->scriptAndCountsVector)[index];
     JSScript *script = sac.script;
 
     StringBuffer buf(cx);
 
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -387,25 +387,25 @@ JOF_OPTYPE(JSOp op)
 }
 
 /* Silence unreferenced formal parameter warnings */
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4100)
 #endif
 
+namespace js {
+
 /*
  * Return a GC'ed string containing the chars in str, with any non-printing
  * chars or quotes (' or " as specified by the quote argument) escaped, and
  * with the quote character at the beginning and end of the result string.
  */
 extern JSString *
-js_QuoteString(js::ExclusiveContext *cx, JSString *str, char16_t quote);
-
-namespace js {
+QuoteString(ExclusiveContext *cx, JSString *str, char16_t quote);
 
 static inline bool
 IsJumpOpcode(JSOp op)
 {
     uint32_t type = JOF_TYPE(js_CodeSpec[op].format);
 
     /*
      * LABEL opcodes have type JOF_JUMP but are no-ops, don't treat them as
@@ -530,23 +530,23 @@ ReconstructStackDepth(JSContext *cx, JSS
 
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif
 
 #define JSDVG_IGNORE_STACK      0
 #define JSDVG_SEARCH_STACK      1
 
+namespace js {
+
 /*
  * Get the length of variable-length bytecode like JSOP_TABLESWITCH.
  */
 extern size_t
-js_GetVariableBytecodeLength(jsbytecode *pc);
-
-namespace js {
+GetVariableBytecodeLength(jsbytecode *pc);
 
 /*
  * Find the source expression that resulted in v, and return a newly allocated
  * C-string containing it.  Fall back on v's string conversion (fallback) if we
  * can't find the bytecode that generated and pushed v on the operand stack.
  *
  * Search the current stack frame if spindex is JSDVG_SEARCH_STACK.  Don't
  * look for v on the stack if spindex is JSDVG_IGNORE_STACK.  Otherwise,
@@ -671,17 +671,17 @@ GetDecomposeLength(jsbytecode *pc, size_
 static inline unsigned
 GetBytecodeLength(jsbytecode *pc)
 {
     JSOp op = (JSOp)*pc;
     MOZ_ASSERT(op < JSOP_LIMIT);
 
     if (js_CodeSpec[op].length != -1)
         return js_CodeSpec[op].length;
-    return js_GetVariableBytecodeLength(pc);
+    return GetVariableBytecodeLength(pc);
 }
 
 static inline bool
 BytecodeIsPopped(jsbytecode *pc)
 {
     jsbytecode *next = pc + GetBytecodeLength(pc);
     return JSOp(*next) == JSOP_POP;
 }
@@ -980,35 +980,32 @@ class PCCounts
 JS_STATIC_ASSERT(sizeof(PCCounts) % sizeof(Value) == 0);
 
 static inline jsbytecode *
 GetNextPc(jsbytecode *pc)
 {
     return pc + GetBytecodeLength(pc);
 }
 
-} /* namespace js */
-
 #if defined(DEBUG)
 /*
  * Disassemblers, for debugging only.
  */
 bool
-js_Disassemble(JSContext *cx, JS::Handle<JSScript*> script, bool lines, js::Sprinter *sp);
+Disassemble(JSContext *cx, JS::Handle<JSScript*> script, bool lines, Sprinter *sp);
 
 unsigned
-js_Disassemble1(JSContext *cx, JS::Handle<JSScript*> script, jsbytecode *pc, unsigned loc,
-                bool lines, js::Sprinter *sp);
+Disassemble1(JSContext *cx, JS::Handle<JSScript*> script, jsbytecode *pc, unsigned loc,
+             bool lines, Sprinter *sp);
 
 #endif
 
 void
-js_DumpPCCounts(JSContext *cx, JS::Handle<JSScript*> script, js::Sprinter *sp);
+DumpPCCounts(JSContext *cx, JS::Handle<JSScript*> script, Sprinter *sp);
 
-namespace js {
 namespace jit { struct IonScriptCounts; }
 void
 DumpIonScriptCounts(js::Sprinter *sp, jit::IonScriptCounts *ionCounts);
 
 void
 DumpCompartmentPCCounts(JSContext *cx);
 }
 
--- a/js/src/jspropertytree.cpp
+++ b/js/src/jspropertytree.cpp
@@ -68,26 +68,26 @@ PropertyTree::insertChild(ExclusiveConte
 
     if (kidp->isShape()) {
         Shape *shape = kidp->toShape();
         MOZ_ASSERT(shape != child);
         MOZ_ASSERT(!shape->matches(child));
 
         KidsHash *hash = HashChildren(shape, child);
         if (!hash) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
         kidp->setHash(hash);
         child->setParent(parent);
         return true;
     }
 
     if (!kidp->toHash()->putNew(StackShape(child), child)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
 
     child->setParent(parent);
     return true;
 }
 
 void
--- a/js/src/jsprototypes.h
+++ b/js/src/jsprototypes.h
@@ -52,68 +52,68 @@
 
 #ifdef ENABLE_SHARED_ARRAY_BUFFER
 #define IF_SAB(real,imaginary) real
 #else
 #define IF_SAB(real,imaginary) imaginary
 #endif
 
 #define JS_FOR_PROTOTYPES(real,imaginary) \
-    imaginary(Null,              0,     js_InitNullClass,          dummy) \
-    real(Object,                 1,     js_InitViaClassSpec,       OCLASP(Plain)) \
-    real(Function,               2,     js_InitViaClassSpec,       &JSFunction::class_) \
-    real(Array,                  3,     js_InitViaClassSpec,       OCLASP(Array)) \
-    real(Boolean,                4,     js_InitBooleanClass,       OCLASP(Boolean)) \
-    real(JSON,                   5,     js_InitJSONClass,          CLASP(JSON)) \
-    real(Date,                   6,     js_InitViaClassSpec,       OCLASP(Date)) \
-    real(Math,                   7,     js_InitMathClass,          CLASP(Math)) \
-    real(Number,                 8,     js_InitNumberClass,        OCLASP(Number)) \
-    real(String,                 9,     js_InitStringClass,        OCLASP(String)) \
-    real(RegExp,                10,     js_InitRegExpClass,        OCLASP(RegExp)) \
-    real(Error,                 11,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_ERR)) \
-    real(InternalError,         12,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_INTERNALERR)) \
-    real(EvalError,             13,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_EVALERR)) \
-    real(RangeError,            14,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_RANGEERR)) \
-    real(ReferenceError,        15,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_REFERENCEERR)) \
-    real(SyntaxError,           16,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_SYNTAXERR)) \
-    real(TypeError,             17,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_TYPEERR)) \
-    real(URIError,              18,     js_InitViaClassSpec,       ERROR_CLASP(JSEXN_URIERR)) \
-    real(Iterator,              19,     js_InitIteratorClasses,    OCLASP(PropertyIterator)) \
-    real(StopIteration,         20,     js_InitIteratorClasses,    OCLASP(StopIteration)) \
-    real(ArrayBuffer,           21,     js_InitArrayBufferClass,   &js::ArrayBufferObject::protoClass) \
-    real(Int8Array,             22,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Int8)) \
-    real(Uint8Array,            23,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8)) \
-    real(Int16Array,            24,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Int16)) \
-    real(Uint16Array,           25,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint16)) \
-    real(Int32Array,            26,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Int32)) \
-    real(Uint32Array,           27,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint32)) \
-    real(Float32Array,          28,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Float32)) \
-    real(Float64Array,          29,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Float64)) \
-    real(Uint8ClampedArray,     30,     js_InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8Clamped)) \
-    real(Proxy,                 31,     js_InitProxyClass,         OCLASP(Proxy)) \
-    real(WeakMap,               32,     js_InitWeakMapClass,       OCLASP(WeakMap)) \
-    real(Map,                   33,     js_InitMapClass,           OCLASP(Map)) \
-    real(Set,                   34,     js_InitSetClass,           OCLASP(Set)) \
-    real(DataView,              35,     js_InitDataViewClass,      OCLASP(DataView)) \
-    real(Symbol,                36,     js_InitSymbolClass,        OCLASP(Symbol)) \
-IF_SAB(real,imaginary)(SharedArrayBuffer,       37,     js_InitSharedArrayBufferClass, &js::SharedArrayBufferObject::protoClass) \
-IF_INTL(real,imaginary) (Intl,                  38,     js_InitIntlClass,          CLASP(Intl)) \
-IF_BDATA(real,imaginary)(TypedObject,           39,     js_InitTypedObjectModuleObject,   OCLASP(TypedObjectModule)) \
-    imaginary(GeneratorFunction,     40,     js_InitIteratorClasses, dummy) \
-IF_BDATA(real,imaginary)(SIMD,                  41,     js_InitSIMDClass, OCLASP(SIMD)) \
-    real(WeakSet,               42,     js_InitWeakSetClass,       OCLASP(WeakSet)) \
-IF_SAB(real,imaginary)(SharedInt8Array,         43,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int8)) \
-IF_SAB(real,imaginary)(SharedUint8Array,        44,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint8)) \
-IF_SAB(real,imaginary)(SharedInt16Array,        45,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int16)) \
-IF_SAB(real,imaginary)(SharedUint16Array,       46,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint16)) \
-IF_SAB(real,imaginary)(SharedInt32Array,        47,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int32)) \
-IF_SAB(real,imaginary)(SharedUint32Array,       48,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint32)) \
-IF_SAB(real,imaginary)(SharedFloat32Array,      49,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Float32)) \
-IF_SAB(real,imaginary)(SharedFloat64Array,      50,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Float64)) \
-IF_SAB(real,imaginary)(SharedUint8ClampedArray, 51,     js_InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint8Clamped)) \
-    real(TypedArray,            52,      js_InitViaClassSpec,      &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
-IF_SAB(real,imaginary)(Atomics,                 53,     js_InitAtomicsClass, OCLASP(Atomics)) \
-    real(SavedFrame,            54,      js_InitViaClassSpec,      &js::SavedFrame::class_) \
+    imaginary(Null,              0,     InitNullClass,          dummy) \
+    real(Object,                 1,     InitViaClassSpec,       OCLASP(Plain)) \
+    real(Function,               2,     InitViaClassSpec,       &JSFunction::class_) \
+    real(Array,                  3,     InitViaClassSpec,       OCLASP(Array)) \
+    real(Boolean,                4,     InitBooleanClass,       OCLASP(Boolean)) \
+    real(JSON,                   5,     InitJSONClass,          CLASP(JSON)) \
+    real(Date,                   6,     InitViaClassSpec,       OCLASP(Date)) \
+    real(Math,                   7,     InitMathClass,          CLASP(Math)) \
+    real(Number,                 8,     InitNumberClass,        OCLASP(Number)) \
+    real(String,                 9,     InitStringClass,        OCLASP(String)) \
+    real(RegExp,                10,     InitRegExpClass,        OCLASP(RegExp)) \
+    real(Error,                 11,     InitViaClassSpec,       ERROR_CLASP(JSEXN_ERR)) \
+    real(InternalError,         12,     InitViaClassSpec,       ERROR_CLASP(JSEXN_INTERNALERR)) \
+    real(EvalError,             13,     InitViaClassSpec,       ERROR_CLASP(JSEXN_EVALERR)) \
+    real(RangeError,            14,     InitViaClassSpec,       ERROR_CLASP(JSEXN_RANGEERR)) \
+    real(ReferenceError,        15,     InitViaClassSpec,       ERROR_CLASP(JSEXN_REFERENCEERR)) \
+    real(SyntaxError,           16,     InitViaClassSpec,       ERROR_CLASP(JSEXN_SYNTAXERR)) \
+    real(TypeError,             17,     InitViaClassSpec,       ERROR_CLASP(JSEXN_TYPEERR)) \
+    real(URIError,              18,     InitViaClassSpec,       ERROR_CLASP(JSEXN_URIERR)) \
+    real(Iterator,              19,     InitIteratorClasses,    OCLASP(PropertyIterator)) \
+    real(StopIteration,         20,     InitIteratorClasses,    OCLASP(StopIteration)) \
+    real(ArrayBuffer,           21,     InitArrayBufferClass,   &js::ArrayBufferObject::protoClass) \
+    real(Int8Array,             22,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int8)) \
+    real(Uint8Array,            23,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8)) \
+    real(Int16Array,            24,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int16)) \
+    real(Uint16Array,           25,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint16)) \
+    real(Int32Array,            26,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int32)) \
+    real(Uint32Array,           27,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint32)) \
+    real(Float32Array,          28,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Float32)) \
+    real(Float64Array,          29,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Float64)) \
+    real(Uint8ClampedArray,     30,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8Clamped)) \
+    real(Proxy,                 31,     InitProxyClass,         OCLASP(Proxy)) \
+    real(WeakMap,               32,     InitWeakMapClass,       OCLASP(WeakMap)) \
+    real(Map,                   33,     InitMapClass,           OCLASP(Map)) \
+    real(Set,                   34,     InitSetClass,           OCLASP(Set)) \
+    real(DataView,              35,     InitDataViewClass,      OCLASP(DataView)) \
+    real(Symbol,                36,     InitSymbolClass,        OCLASP(Symbol)) \
+IF_SAB(real,imaginary)(SharedArrayBuffer,       37,     InitSharedArrayBufferClass, &js::SharedArrayBufferObject::protoClass) \
+IF_INTL(real,imaginary) (Intl,                  38,     InitIntlClass,          CLASP(Intl)) \
+IF_BDATA(real,imaginary)(TypedObject,           39,     InitTypedObjectModuleObject,   OCLASP(TypedObjectModule)) \
+    imaginary(GeneratorFunction,     40,     InitIteratorClasses, dummy) \
+IF_BDATA(real,imaginary)(SIMD,                  41,     InitSIMDClass, OCLASP(SIMD)) \
+    real(WeakSet,               42,     InitWeakSetClass,       OCLASP(WeakSet)) \
+IF_SAB(real,imaginary)(SharedInt8Array,         43,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int8)) \
+IF_SAB(real,imaginary)(SharedUint8Array,        44,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint8)) \
+IF_SAB(real,imaginary)(SharedInt16Array,        45,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int16)) \
+IF_SAB(real,imaginary)(SharedUint16Array,       46,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint16)) \
+IF_SAB(real,imaginary)(SharedInt32Array,        47,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Int32)) \
+IF_SAB(real,imaginary)(SharedUint32Array,       48,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint32)) \
+IF_SAB(real,imaginary)(SharedFloat32Array,      49,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Float32)) \
+IF_SAB(real,imaginary)(SharedFloat64Array,      50,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Float64)) \
+IF_SAB(real,imaginary)(SharedUint8ClampedArray, 51,     InitViaClassSpec,       SHARED_TYPED_ARRAY_CLASP(Uint8Clamped)) \
+    real(TypedArray,            52,      InitViaClassSpec,      &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
+IF_SAB(real,imaginary)(Atomics,                 53,     InitAtomicsClass, OCLASP(Atomics)) \
+    real(SavedFrame,            54,      InitViaClassSpec,      &js::SavedFrame::class_) \
 
 
 #define JS_FOR_EACH_PROTOTYPE(macro) JS_FOR_PROTOTYPES(macro,macro)
 
 #endif /* jsprototypes_h */
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -114,19 +114,20 @@ typedef JSConstScalarSpec<int32_t> JSCon
 
 /*
  * Generic trace operation that calls JS_CallTracer on each traceable thing
  * stored in data.
  */
 typedef void
 (* JSTraceDataOp)(JSTracer *trc, void *data);
 
-void js_FinishGC(JSRuntime *rt);
+namespace js {
 
-namespace js {
+void FinishGC(JSRuntime *rt);
+
 namespace gc {
 class StoreBuffer;
 void MarkPersistentRootedChains(JSTracer *);
 void FinishPersistentRootedChains(JSRuntime *);
 }
 }
 
 namespace JS {
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -106,25 +106,25 @@ typedef AutoValueVector NodeVector;
  * evolved, making it more likely that there could be a disconnect between the
  * parser and the AST serializer. We use these macros to check invariants on a
  * parse node and raise a dynamic error on failure.
  */
 #define LOCAL_ASSERT(expr)                                                                \
     JS_BEGIN_MACRO                                                                        \
         MOZ_ASSERT(expr);                                                                 \
         if (!(expr)) {                                                                    \
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE);  \
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE);     \
             return false;                                                                 \
         }                                                                                 \
     JS_END_MACRO
 
 #define LOCAL_NOT_REACHED(expr)                                                           \
     JS_BEGIN_MACRO                                                                        \
         MOZ_ASSERT(false);                                                                \
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE);      \
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE);         \
         return false;                                                                     \
     JS_END_MACRO
 
 namespace {
 
 /* Set 'result' to obj[id] if any such property exists, else defaultValue. */
 static bool
 GetPropertyDefault(JSContext *cx, HandleObject obj, HandleId id, HandleValue defaultValue,
@@ -195,18 +195,18 @@ class NodeBuilder
                 return false;
 
             if (funv.isNullOrUndefined()) {
                 callbacks[i].setNull();
                 continue;
             }
 
             if (!funv.isObject() || !funv.toObject().is<JSFunction>()) {
-                js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NOT_FUNCTION,
-                                         JSDVG_SEARCH_STACK, funv, js::NullPtr(), nullptr, nullptr);
+                ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NOT_FUNCTION,
+                                      JSDVG_SEARCH_STACK, funv, js::NullPtr(), nullptr, nullptr);
                 return false;
             }
 
             callbacks[i].set(funv);
         }
 
         return true;
     }
@@ -721,17 +721,17 @@ NodeBuilder::newNode(ASTType type, Token
     return true;
 }
 
 bool
 NodeBuilder::newArray(NodeVector &elts, MutableHandleValue dst)
 {
     const size_t len = elts.length();
     if (len > UINT32_MAX) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return false;
     }
     RootedObject array(cx, NewDenseFullyAllocatedArray(cx, uint32_t(len)));
     if (!array)
         return false;
 
     for (size_t i = 0; i < len; i++) {
         RootedValue val(cx, elts[i]);
@@ -3547,17 +3547,17 @@ ASTSerializer::functionBody(ParseNode *p
 }
 
 static bool
 reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "Reflect.parse", "0", "s");
         return false;
     }
 
     RootedString src(cx, ToString<CanGC>(cx, args[0]));
     if (!src)
         return false;
 
@@ -3566,19 +3566,19 @@ reflect_parse(JSContext *cx, uint32_t ar
     bool loc = true;
 
     RootedObject builder(cx);
 
     RootedValue arg(cx, args.get(1));
 
     if (!arg.isNullOrUndefined()) {
         if (!arg.isObject()) {
-            js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                     JSDVG_SEARCH_STACK, arg, js::NullPtr(),
-                                     "not an object", nullptr);
+            ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                                  JSDVG_SEARCH_STACK, arg, js::NullPtr(),
+                                  "not an object", nullptr);
             return false;
         }
 
         RootedObject config(cx, &arg.toObject());
 
         RootedValue prop(cx);
 
         /* config.loc */
@@ -3618,19 +3618,19 @@ reflect_parse(JSContext *cx, uint32_t ar
         /* config.builder */
         RootedId builderId(cx, NameToId(cx->names().builder));
         RootedValue nullVal(cx, NullValue());
         if (!GetPropertyDefault(cx, config, builderId, nullVal, &prop))
             return false;
 
         if (!prop.isNullOrUndefined()) {
             if (!prop.isObject()) {
-                js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
-                                         JSDVG_SEARCH_STACK, prop, js::NullPtr(),
-                                         "not an object", nullptr);
+                ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
+                                      JSDVG_SEARCH_STACK, prop, js::NullPtr(),
+                                      "not an object", nullptr);
                 return false;
             }
             builder = &prop.toObject();
         }
     }
 
     /* Extract the builder methods first to report errors before parsing. */
     ASTSerializer serialize(cx, loc, filename, lineno);
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -2059,17 +2059,17 @@ ScriptSource::setFilename(ExclusiveConte
 
 bool
 ScriptSource::setDisplayURL(ExclusiveContext *cx, const char16_t *displayURL)
 {
     MOZ_ASSERT(displayURL);
     if (hasDisplayURL()) {
         if (cx->isJSContext() &&
             !JS_ReportErrorFlagsAndNumber(cx->asJSContext(), JSREPORT_WARNING,
-                                          js_GetErrorMessage, nullptr,
+                                          GetErrorMessage, nullptr,
                                           JSMSG_ALREADY_HAS_PRAGMA, filename_.get(),
                                           "//# sourceURL"))
         {
             return false;
         }
     }
     size_t len = js_strlen(displayURL) + 1;
     if (len == 1)
@@ -2164,17 +2164,17 @@ SaveSharedScriptData(ExclusiveContext *c
     if (p) {
         js_free(ssd);
         ssd = *p;
     } else {
         if (!cx->scriptDataTable().add(p, ssd)) {
             script->setCode(nullptr);
             script->atoms = nullptr;
             js_free(ssd);
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return false;
         }
     }
 
     /*
      * During the IGC we need to ensure that bytecode is marked whenever it is
      * accessed even if the bytecode was already in the table: at this point
      * old scripts or exceptions pointing to the bytecode may no longer be
@@ -2375,17 +2375,17 @@ JSScript::initCompartment(ExclusiveConte
 
 JSScript *
 JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCallerFun,
                  const ReadOnlyCompileOptions &options, unsigned staticLevel,
                  HandleObject sourceObject, uint32_t bufStart, uint32_t bufEnd)
 {
     MOZ_ASSERT(bufStart <= bufEnd);
 
-    RootedScript script(cx, js_NewGCScript(cx));
+    RootedScript script(cx, NewGCScript(cx));
     if (!script)
         return nullptr;
 
     PodZero(script.get());
     new (&script->bindings) Bindings;
 
     script->enclosingStaticScope_ = enclosingScope;
     script->savedCallerFun_ = savedCallerFun;
@@ -2400,17 +2400,17 @@ JSScript::Create(ExclusiveContext *cx, H
 
     // This is an unsigned-to-uint16_t conversion, test for too-high values.
     // In practice, recursion in Parser and/or BytecodeEmitter will blow the
     // stack if we nest functions more than a few hundred deep, so this will
     // never trigger.  Oh well.
     if (staticLevel > UINT16_MAX) {
         if (cx->isJSContext()) {
             JS_ReportErrorNumber(cx->asJSContext(),
-                                 js_GetErrorMessage, nullptr, JSMSG_TOO_DEEP, js_function_str);
+                                 GetErrorMessage, nullptr, JSMSG_TOO_DEEP, js_function_str);
         }
         return nullptr;
     }
     script->staticLevel_ = uint16_t(staticLevel);
 
     script->setSourceObject(sourceObject);
     script->sourceStart_ = bufStart;
     script->sourceEnd_ = bufEnd;
@@ -2774,17 +2774,17 @@ js::GetSrcNote(GSNCache &cache, JSScript
             cache.code = script->code();
         }
     }
 
     return result;
 }
 
 jssrcnote *
-js_GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc)
+js::GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc)
 {
     return GetSrcNote(cx->runtime()->gsnCache, script, pc);
 }
 
 unsigned
 js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbytecode *pc,
                    unsigned *columnp)
 {
@@ -2833,17 +2833,17 @@ js::PCToLineNumber(JSScript *script, jsb
     /* Cope with InterpreterFrame.pc value prior to entering Interpret. */
     if (!pc)
         return 0;
 
     return PCToLineNumber(script->lineno(), script->notes(), script->code(), pc, columnp);
 }
 
 jsbytecode *
-js_LineNumberToPC(JSScript *script, unsigned target)
+js::LineNumberToPC(JSScript *script, unsigned target)
 {
     ptrdiff_t offset = 0;
     ptrdiff_t best = -1;
     unsigned lineno = script->lineno();
     unsigned bestdiff = SN_MAX_OFFSET;
     for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
         /*
          * Exact-match only if offset is not in the prolog; otherwise use
@@ -2868,17 +2868,17 @@ js_LineNumberToPC(JSScript *script, unsi
     }
     if (best >= 0)
         offset = best;
 out:
     return script->offsetToPC(offset);
 }
 
 JS_FRIEND_API(unsigned)
-js_GetScriptLineExtent(JSScript *script)
+js::GetScriptLineExtent(JSScript *script)
 {
     unsigned lineno = script->lineno();
     unsigned maxLineNo = lineno;
     for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
         SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
         if (type == SRC_SETLINE)
             lineno = (unsigned) js_GetSrcNoteOffset(sn, 0);
         else if (type == SRC_NEWLINE)
@@ -3317,17 +3317,17 @@ JSScript::getOrCreateBreakpointSite(JSCo
         return nullptr;
 
     DebugScript *debug = debugScript();
     BreakpointSite *&site = debug->breakpoints[pcToOffset(pc)];
 
     if (!site) {
         site = cx->runtime()->new_<BreakpointSite>(this, pc);
         if (!site) {
-            js_ReportOutOfMemory(cx);
+            ReportOutOfMemory(cx);
             return nullptr;
         }
         debug->numSites++;
     }
 
     return site;
 }
 
@@ -3753,17 +3753,17 @@ LazyScript::CreateRaw(ExclusiveContext *
 
     size_t bytes = (p.numFreeVariables * sizeof(FreeVariable))
                  + (p.numInnerFunctions * sizeof(HeapPtrFunction));
 
     ScopedJSFreePtr<uint8_t> table(bytes ? fun->zone()->pod_malloc<uint8_t>(bytes) : nullptr);
     if (bytes && !table)
         return nullptr;
 
-    LazyScript *res = js_NewGCLazyScript(cx);
+    LazyScript *res = NewGCLazyScript(cx);
     if (!res)
         return nullptr;
 
     cx->compartment()->scheduleDelazificationForDebugger();
 
     return new (res) LazyScript(fun, table.forget(), packed, begin, end, lineno, column);
 }
 
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -739,17 +739,17 @@ static inline GeneratorKind
 GeneratorKindFromBits(unsigned val) {
     MOZ_ASSERT(val <= StarGenerator);
     return static_cast<GeneratorKind>(val);
 }
 
 /*
  * NB: after a successful XDR_DECODE, XDRScript callers must do any required
  * subsequent set-up of owning function or script object and then call
- * js_CallNewScriptHook.
+ * CallNewScriptHook.
  */
 template<XDRMode mode>
 bool
 XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enclosingScript,
           HandleFunction fun, MutableHandleScript scriptp);
 
 JSScript *
 CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HandleScript script,
@@ -2115,26 +2115,26 @@ struct ScriptAndCounts
     }
 };
 
 struct GSNCache;
 
 jssrcnote *
 GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc);
 
-} /* namespace js */
-
 extern jssrcnote *
-js_GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc);
+GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc);
 
 extern jsbytecode *
-js_LineNumberToPC(JSScript *script, unsigned lineno);
+LineNumberToPC(JSScript *script, unsigned lineno);
 
 extern JS_FRIEND_API(unsigned)
-js_GetScriptLineExtent(JSScript *script);
+GetScriptLineExtent(JSScript *script);
+
+} /* namespace js */
 
 namespace js {
 
 extern unsigned
 PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp = nullptr);
 
 extern unsigned
 PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbytecode *pc,
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -441,24 +441,24 @@ ThisToStringForStringProto(JSContext *cx
     if (call.thisv().isString())
         return call.thisv().toString();
 
     if (call.thisv().isObject()) {
         RootedObject obj(cx, &call.thisv().toObject());
         if (obj->is<StringObject>()) {
             StringObject *nobj = &obj->as<StringObject>();
             Rooted<jsid> id(cx, NameToId(cx->names().toString));
-            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, js_str_toString)) {
+            if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString)) {
                 JSString *str = nobj->unbox();
                 call.setThis(StringValue(str));
                 return str;
             }
         }
     } else if (call.thisv().isNullOrUndefined()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                              call.thisv().isNull() ? "null" : "undefined", "object");
         return nullptr;
     }
 
     JSString *str = ToStringSlow<CanGC>(cx, call.thisv());
     if (!str)
         return nullptr;
 
@@ -478,17 +478,17 @@ MOZ_ALWAYS_INLINE bool
 str_toSource_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsString(args.thisv()));
 
     Rooted<JSString*> str(cx, ToString<CanGC>(cx, args.thisv()));
     if (!str)
         return false;
 
-    str = js_QuoteString(cx, str, '"');
+    str = QuoteString(cx, str, '"');
     if (!str)
         return false;
 
     StringBuffer sb(cx);
     if (!sb.append("(new String(") || !sb.append(str) || !sb.append("))"))
         return false;
 
     str = sb.finishString();
@@ -514,17 +514,17 @@ str_toString_impl(JSContext *cx, CallArg
 
     args.rval().setString(args.thisv().isString()
                               ? args.thisv().toString()
                               : args.thisv().toObject().as<StringObject>().unbox());
     return true;
 }
 
 bool
-js_str_toString(JSContext *cx, unsigned argc, Value *vp)
+js::str_toString(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsString, str_toString_impl>(cx, args);
 }
 
 /*
  * Java-like string native methods.
  */
@@ -896,17 +896,17 @@ str_normalize(JSContext *cx, unsigned ar
             form = UNORM_NFC;
         } else if (formStr == cx->names().NFD) {
             form = UNORM_NFD;
         } else if (formStr == cx->names().NFKC) {
             form = UNORM_NFKC;
         } else if (formStr == cx->names().NFKD) {
             form = UNORM_NFKD;
         } else {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                  JSMSG_INVALID_NORMALIZE_FORM);
             return false;
         }
     }
 
     // Step 8.
     AutoStableStringChars stableChars(cx);
     if (!str->ensureFlat(cx) || !stableChars.initTwoByte(cx, str))
@@ -945,17 +945,17 @@ str_normalize(JSContext *cx, unsigned ar
 
     // Step 9.
     args.rval().setString(ns);
     return true;
 }
 #endif
 
 bool
-js_str_charAt(JSContext *cx, unsigned argc, Value *vp)
+js::str_charAt(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedString str(cx);
     size_t i;
     if (args.thisv().isString() && args.length() != 0 && args[0].isInt32()) {
         str = args.thisv().toString();
         i = size_t(args[0].toInt32());
@@ -1011,17 +1011,17 @@ js::str_charCodeAt_impl(JSContext *cx, H
     return true;
 
 out_of_range:
     res.setNaN();
     return true;
 }
 
 bool
-js_str_charCodeAt(JSContext *cx, unsigned argc, Value *vp)
+js::str_charCodeAt(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     RootedString str(cx);
     RootedValue index(cx);
     if (args.thisv().isString()) {
         str = args.thisv().toString();
     } else {
         str = ThisToStringForStringProto(cx, args);
@@ -1728,17 +1728,17 @@ js::str_startsWith(JSContext *cx, unsign
 
     // Steps 1, 2, and 3
     RootedString str(cx, ThisToStringForStringProto(cx, args));
     if (!str)
         return false;
 
     // Step 4
     if (args.get(0).isObject() && IsObjectWithClass(args[0], ESClass_RegExp, cx)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
                              "first", "", "Regular Expression");
         return false;
     }
 
     // Steps 5 and 6
     RootedLinearString searchStr(cx, ArgToRootedString(cx, args, 0));
     if (!searchStr)
         return false;
@@ -1789,17 +1789,17 @@ str_endsWith(JSContext *cx, unsigned arg
 
     // Steps 1, 2, and 3
     RootedString str(cx, ThisToStringForStringProto(cx, args));
     if (!str)
         return false;
 
     // Step 4
     if (args.get(0).isObject() && IsObjectWithClass(args[0], ESClass_RegExp, cx)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_INVALID_ARG_TYPE,
                              "first", "", "Regular Expression");
         return false;
     }
 
     // Steps 5 and 6
     RootedLinearString searchStr(cx, ArgToRootedString(cx, args, 0));
     if (!searchStr)
         return false;
@@ -2646,17 +2646,17 @@ FindReplaceLengthString(JSContext *cx, R
                 dp++;
             }
 
             dp = js_strchr_limit(dp, '$', ep);
         } while (dp);
     }
 
     if (!replen.isValid()) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return false;
     }
 
     *sizep = replen.value();
     return true;
 }
 
 static bool
@@ -2809,17 +2809,17 @@ ReplaceRegExp(JSContext *cx, RegExpStati
     size_t replen = 0;  /* silence 'unused' warning */
     if (!FindReplaceLength(cx, res, rdata, &replen))
         return false;
 
     CheckedInt<uint32_t> newlen(rdata.sb.length());
     newlen += leftlen;
     newlen += replen;
     if (!newlen.isValid()) {
-        js_ReportAllocationOverflow(cx);
+        ReportAllocationOverflow(cx);
         return false;
     }
 
     /*
      * Inflate the buffer now if needed, to avoid (fallible) Latin1 to TwoByte
      * inflation later on.
      */
     JSLinearString &str = rdata.str->asLinear();  /* flattened for regexp */
@@ -3929,22 +3929,22 @@ str_concat(JSContext *cx, unsigned argc,
 }
 
 static const JSFunctionSpec string_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,     str_toSource,          0,0),
 #endif
 
     /* Java-like methods. */
-    JS_FN(js_toString_str,     js_str_toString,       0,0),
-    JS_FN(js_valueOf_str,      js_str_toString,       0,0),
+    JS_FN(js_toString_str,     str_toString,          0,0),
+    JS_FN(js_valueOf_str,      str_toString,          0,0),
     JS_FN("toLowerCase",       str_toLowerCase,       0,JSFUN_GENERIC_NATIVE),
     JS_FN("toUpperCase",       str_toUpperCase,       0,JSFUN_GENERIC_NATIVE),
-    JS_FN("charAt",            js_str_charAt,         1,JSFUN_GENERIC_NATIVE),
-    JS_FN("charCodeAt",        js_str_charCodeAt,     1,JSFUN_GENERIC_NATIVE),
+    JS_FN("charAt",            str_charAt,            1,JSFUN_GENERIC_NATIVE),
+    JS_FN("charCodeAt",        str_charCodeAt,        1,JSFUN_GENERIC_NATIVE),
     JS_SELF_HOSTED_FN("substring", "String_substring", 2,0),
     JS_SELF_HOSTED_FN("codePointAt", "String_codePointAt", 1,0),
     JS_FN("contains",          str_contains,          1,JSFUN_GENERIC_NATIVE),
     JS_FN("indexOf",           str_indexOf,           1,JSFUN_GENERIC_NATIVE),
     JS_FN("lastIndexOf",       str_lastIndexOf,       1,JSFUN_GENERIC_NATIVE),
     JS_FN("startsWith",        str_startsWith,        1,JSFUN_GENERIC_NATIVE),
     JS_FN("endsWith",          str_endsWith,          1,JSFUN_GENERIC_NATIVE),
     JS_FN("trim",              str_trim,              0,JSFUN_GENERIC_NATIVE),
@@ -3989,17 +3989,17 @@ static const JSFunctionSpec string_metho
     JS_SELF_HOSTED_FN("fontsize", "String_fontsize",   1,0),
 
     JS_SELF_HOSTED_SYM_FN(iterator, "String_iterator", 0,0),
     JS_FS_END
 };
 
 // ES6 rev 27 (2014 Aug 24) 21.1.1
 bool
-js_String(JSContext *cx, unsigned argc, Value *vp)
+js::StringConstructor(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedString str(cx);
     if (args.length() > 0) {
         if (!args.isConstructing() && args[0].isSymbol())
             return js::SymbolDescriptiveString(cx, args[0].toSymbol(), args.rval());
 
@@ -4097,30 +4097,30 @@ StringObject::assignInitialShape(Exclusi
 {
     MOZ_ASSERT(obj->empty());
 
     return obj->addDataProperty(cx, cx->names().length, LENGTH_SLOT,
                                 JSPROP_PERMANENT | JSPROP_READONLY);
 }
 
 JSObject *
-js_InitStringClass(JSContext *cx, HandleObject obj)
+js::InitStringClass(JSContext *cx, HandleObject obj)
 {
     MOZ_ASSERT(obj->isNative());
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     Rooted<JSString*> empty(cx, cx->runtime()->emptyString);
     RootedObject proto(cx, global->createBlankPrototype(cx, &StringObject::class_));
     if (!proto || !proto->as<StringObject>().init(cx, empty))
         return nullptr;
 
     /* Now create the String function. */
     RootedFunction ctor(cx);
-    ctor = global->createConstructor(cx, js_String, cx->names().String, 1);
+    ctor = global->createConstructor(cx, StringConstructor, cx->names().String, 1);
     if (!ctor)
         return nullptr;
 
     if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_String, ctor, proto))
         return nullptr;
 
     if (!LinkConstructorAndPrototype(cx, ctor, proto))
         return nullptr;
@@ -4137,27 +4137,27 @@ js_InitStringClass(JSContext *cx, Handle
      */
     if (!JS_DefineFunctions(cx, global, string_functions))
         return nullptr;
 
     return proto;
 }
 
 const char *
-js_ValueToPrintable(JSContext *cx, const Value &vArg, JSAutoByteString *bytes, bool asSource)
+js::ValueToPrintable(JSContext *cx, const Value &vArg, JSAutoByteString *bytes, bool asSource)
 {
     RootedValue v(cx, vArg);
     JSString *str;
     if (asSource)
         str = ValueToSource(cx, v);
     else
         str = ToString<CanGC>(cx, v);
     if (!str)
         return nullptr;
-    str = js_QuoteString(cx, str, 0);
+    str = QuoteString(cx, str, 0);
     if (!str)
         return nullptr;
     return bytes->encodeLatin1(cx, str);
 }
 
 template <AllowGC allowGC>
 JSString *
 js::ToStringSlow(ExclusiveContext *cx, typename MaybeRooted<Value, allowGC>::HandleType arg)
@@ -4178,22 +4178,22 @@ js::ToStringSlow(ExclusiveContext *cx, t
     JSString *str;
     if (v.isString()) {
         str = v.toString();
     } else if (v.isInt32()) {
         str = Int32ToString<allowGC>(cx, v.toInt32());
     } else if (v.isDouble()) {
         str = NumberToString<allowGC>(cx, v.toDouble());
     } else if (v.isBoolean()) {
-        str = js_BooleanToString(cx, v.toBoolean());
+        str = BooleanToString(cx, v.toBoolean());
     } else if (v.isNull()) {
         str = cx->names().null;
     } else if (v.isSymbol()) {
         if (cx->shouldBeJSContext() && allowGC) {
-            JS_ReportErrorNumber(cx->asJSContext(), js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(cx->asJSContext(), GetErrorMessage, nullptr,
                                  JSMSG_SYMBOL_TO_STRING);
         }
         return nullptr;
     } else {
         MOZ_ASSERT(v.isUndefined());
         str = cx->names().undefined;
     }
     return str;
@@ -4270,17 +4270,17 @@ js::ValueToSource(JSContext *cx, HandleV
     }
 
     return ObjectToSource(cx, obj);
 }
 
 JSString *
 js::StringToSource(JSContext *cx, JSString *str)
 {
-    return js_QuoteString(cx, str, '"');
+    return QuoteString(cx, str, '"');
 }
 
 bool
 js::EqualChars(JSLinearString *str1, JSLinearString *str2)
 {
     MOZ_ASSERT(str1->length() == str2->length());
 
     size_t len = str1->length();
@@ -4506,17 +4506,17 @@ js::DeflateStringToBuffer(JSContext *may
                           char *dst, size_t *dstlenp)
 {
     size_t dstlen = *dstlenp;
     if (srclen > dstlen) {
         for (size_t i = 0; i < dstlen; i++)
             dst[i] = char(src[i]);
         if (maybecx) {
             AutoSuppressGC suppress(maybecx);
-            JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
+            JS_ReportErrorNumber(maybecx, GetErrorMessage, nullptr,
                                  JSMSG_BUFFER_TOO_SMALL);
         }
         return false;
     }
     for (size_t i = 0; i < srclen; i++)
         dst[i] = char(src[i]);
     *dstlenp = srclen;
     return true;
@@ -4715,17 +4715,17 @@ Encode(StringBuffer &sb, const CharT *ch
 
                 char16_t c2 = chars[k];
                 if (c2 < 0xDC00 || c2 > 0xDFFF)
                     return Encode_BadUri;
 
                 v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000;
             }
             uint8_t utf8buf[4];
-            size_t L = js_OneUcs4ToUtf8Char(utf8buf, v);
+            size_t L = OneUcs4ToUtf8Char(utf8buf, v);
             for (size_t j = 0; j < L; j++) {
                 hexBuf[1] = HexDigits[utf8buf[j] >> 4];
                 hexBuf[2] = HexDigits[utf8buf[j] & 0xf];
                 if (!sb.append(hexBuf, 3))
                     return Encode_Failure;
             }
         }
     }
@@ -4755,17 +4755,17 @@ Encode(JSContext *cx, HandleLinearString
         AutoCheckCannotGC nogc;
         res = Encode(sb, str->twoByteChars(nogc), str->length(), unescapedSet, unescapedSet2);
     }
 
     if (res == Encode_Failure)
         return false;
 
     if (res == Encode_BadUri) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI, nullptr);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_URI, nullptr);
         return false;
     }
 
     MOZ_ASSERT(res == Encode_Success);
     return TransferBufferToString(sb, rval);
 }
 
 enum DecodeResult { Decode_Failure, Decode_BadUri, Decode_Success };
@@ -4865,17 +4865,17 @@ Decode(JSContext *cx, HandleLinearString
         AutoCheckCannotGC nogc;
         res = Decode(sb, str->twoByteChars(nogc), str->length(), reservedSet);
     }
 
     if (res == Decode_Failure)
         return false;
 
     if (res == Decode_BadUri) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_URI);
         return false;
     }
 
     MOZ_ASSERT(res == Decode_Success);
     return TransferBufferToString(sb, rval);
 }
 
 static bool
@@ -4922,17 +4922,17 @@ str_encodeURI_Component(JSContext *cx, u
     return Encode(cx, str, js_isUriUnescaped, nullptr, args.rval());
 }
 
 /*
  * Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at
  * least 4 bytes long.  Return the number of UTF-8 bytes of data written.
  */
 int
-js_OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char)
+js::OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char)
 {
     int utf8Length = 1;
 
     MOZ_ASSERT(ucs4Char <= 0x10FFFF);
     if (ucs4Char < 0x80) {
         *utf8Buffer = (uint8_t)ucs4Char;
     } else {
         int i;
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -92,27 +92,16 @@ struct JSSubString {
 #define JS7_ISDEC(c)    ((((unsigned)(c)) - '0') <= 9)
 #define JS7_UNDEC(c)    ((c) - '0')
 #define JS7_ISOCT(c)    ((((unsigned)(c)) - '0') <= 7)
 #define JS7_UNOCT(c)    (JS7_UNDEC(c))
 #define JS7_ISHEX(c)    ((c) < 128 && isxdigit(c))
 #define JS7_UNHEX(c)    (unsigned)(JS7_ISDEC(c) ? (c) - '0' : 10 + tolower(c) - 'a')
 #define JS7_ISLET(c)    ((c) < 128 && isalpha(c))
 
-/* Initialize the String class, returning its prototype object. */
-extern JSObject *
-js_InitStringClass(JSContext *cx, js::HandleObject obj);
-
-/*
- * Convert a value to a printable C string.
- */
-extern const char *
-js_ValueToPrintable(JSContext *cx, const js::Value &,
-                    JSAutoByteString *bytes, bool asSource = false);
-
 extern size_t
 js_strlen(const char16_t *s);
 
 extern int32_t
 js_strcmp(const char16_t *lhs, const char16_t *rhs);
 
 template <typename CharT>
 extern const CharT *
@@ -121,16 +110,26 @@ js_strchr_limit(const CharT *s, char16_t
 static MOZ_ALWAYS_INLINE void
 js_strncpy(char16_t *dst, const char16_t *src, size_t nelem)
 {
     return mozilla::PodCopy(dst, src, nelem);
 }
 
 namespace js {
 
+/* Initialize the String class, returning its prototype object. */
+extern JSObject *
+InitStringClass(JSContext *cx, HandleObject obj);
+
+/*
+ * Convert a value to a printable C string.
+ */
+extern const char *
+ValueToPrintable(JSContext *cx, const Value &, JSAutoByteString *bytes, bool asSource = false);
+
 extern mozilla::UniquePtr<char[], JS::FreePolicy>
 DuplicateString(ExclusiveContext *cx, const char *s);
 
 extern mozilla::UniquePtr<char16_t[], JS::FreePolicy>
 DuplicateString(ExclusiveContext *cx, const char16_t *s);
 
 /*
  * Convert a non-string value to a string, returning null after reporting an
@@ -322,41 +321,33 @@ extern bool
 str_startsWith(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
 str_toLowerCase(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
 str_toUpperCase(JSContext *cx, unsigned argc, Value *vp);
 
-} /* namespace js */
+extern bool
+str_toString(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
-js_str_toString(JSContext *cx, unsigned argc, js::Value *vp);
-
-extern bool
-js_str_charAt(JSContext *cx, unsigned argc, js::Value *vp);
-
-namespace js {
+str_charAt(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
 str_charCodeAt_impl(JSContext *cx, HandleString string, HandleValue index, MutableHandleValue res);
 
-} /* namespace js */
-
 extern bool
-js_str_charCodeAt(JSContext *cx, unsigned argc, js::Value *vp);
+str_charCodeAt(JSContext *cx, unsigned argc, Value *vp);
 /*
  * Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at
  * least 6 bytes long.  Return the number of UTF-8 bytes of data written.
  */
 extern int
-js_OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char);
-
-namespace js {
+OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char);
 
 extern size_t
 PutEscapedStringImpl(char *buffer, size_t size, FILE *fp, JSLinearString *str, uint32_t quote);
 
 template <typename CharT>
 extern size_t
 PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, const CharT *chars,
                      size_t length, uint32_t quote);
@@ -426,14 +417,14 @@ str_resolve(JSContext *cx, HandleObject 
 bool
 str_replace_regexp_raw(JSContext *cx, HandleString string, HandleObject regexp,
                        HandleString replacement, MutableHandleValue rval);
 
 bool
 str_replace_string_raw(JSContext *cx, HandleString string, HandleString pattern,
                        HandleString replacement, MutableHandleValue rval);
 
+extern bool
+StringConstructor(JSContext *cx, unsigned argc, Value *vp);
+
 } /* namespace js */
 
-extern bool
-js_String(JSContext *cx, unsigned argc, js::Value *vp);
-
 #endif /* jsstr_h */
--- a/js/src/jswatchpoint.cpp
+++ b/js/src/jswatchpoint.cpp
@@ -63,17 +63,17 @@ WatchpointMap::watch(JSContext *cx, Hand
 {
     MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id) || JSID_IS_SYMBOL(id));
 
     if (!obj->setWatched(cx))
         return false;
 
     Watchpoint w(handler, closure, false);
     if (!map.put(WatchKey(obj, id), w)) {
-        js_ReportOutOfMemory(cx);
+        ReportOutOfMemory(cx);
         return false;
     }
     /*
      * For generational GC, we don't need to post-barrier writes to the
      * hashtable here because we mark all watchpoints as part of root marking in
      * markAll().
      */
     return true;
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -320,17 +320,17 @@ TryPreserveReflector(JSContext *cx, Hand
 {
     if (obj->getClass()->ext.isWrappedNative ||
         (obj->getClass()->flags & JSCLASS_IS_DOMJSCLASS) ||
         (obj->is<ProxyObject>() &&
          obj->as<ProxyObject>().handler()->family() == GetDOMProxyHandlerFamily()))
     {
         MOZ_ASSERT(cx->runtime()->preserveWrapperCallback);
         if (!cx->runtime()->preserveWrapperCallback(cx, obj)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY);
             return false;
         }
     }
     return true;
 }
 
 static inline void
 WeakMapPostWriteBarrier(JSRuntime *rt, ObjectValueMap *weakMap, JSObject *key)
@@ -382,17 +382,17 @@ MOZ_ALWAYS_INLINE bool
 WeakMap_set_impl(JSContext *cx, CallArgs args)
 {
     MOZ_ASSERT(IsWeakMap(args.thisv()));
 
     if (!args.get(0).isObject()) {
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, args.get(0), NullPtr());
         if (!bytes)
             return false;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
         return false;
     }
 
     RootedObject key(cx, &args[0].toObject());
     Rooted<JSObject*> thisObj(cx, &args.thisv().toObject());
     Rooted<WeakMapObject*> map(cx, &thisObj->as<WeakMapObject>());
 
     if (!SetWeakMapEntryInternal(cx, map, key, args.get(1)))
@@ -543,17 +543,17 @@ WeakMap_construct(JSContext *cx, unsigne
             bool done;
             if (!iter.next(&pairVal, &done))
                 return false;
             if (done)
                 break;
 
             // Step 12f.
             if (!pairVal.isObject()) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+                JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                                      JSMSG_INVALID_MAP_ITERABLE, "WeakMap");
                 return false;
             }
 
             pairObject = &pairVal.toObject();
             if (!pairObject)
                 return false;
 
@@ -566,17 +566,17 @@ WeakMap_construct(JSContext *cx, unsigne
                 return false;
 
             // Steps 12k-l.
             if (isOriginalAdder) {
                 if (keyVal.isPrimitive()) {
                     char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, NullPtr());
                     if (!bytes)
                         return false;
-                    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
+                    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes);
                     return false;
                 }
 
                 keyObject = &keyVal.toObject();
                 if (!SetWeakMapEntry(cx, obj, keyObject, val))
                     return false;
             } else {
                 if (!args2.init(2))
@@ -649,17 +649,17 @@ InitWeakMapClass(JSContext *cx, HandleOb
     }
 
     if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_WeakMap, ctor, weakMapProto))
         return nullptr;
     return weakMapProto;
 }
 
 JSObject *
-js_InitWeakMapClass(JSContext *cx, HandleObject obj)
+js::InitWeakMapClass(JSContext *cx, HandleObject obj)
 {
     return InitWeakMapClass(cx, obj, true);
 }
 
 JSObject *
 js::InitBareWeakMapCtor(JSContext *cx, HandleObject obj)
 {
     return InitWeakMapClass(cx, obj, false);
--- a/js/src/jsweakmap.h
+++ b/js/src/jsweakmap.h
@@ -317,14 +317,14 @@ extern bool
 WeakMap_set(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
 WeakMap_delete(JSContext *cx, unsigned argc, Value *vp);
 
 extern bool
 WeakMap_clear(JSContext *cx, unsigned argc, Value *vp);
 
+extern JSObject *
+InitWeakMapClass(JSContext *cx, HandleObject obj);
+
 } /* namespace js */
 
-extern JSObject *
-js_InitWeakMapClass(JSContext *cx, js::HandleObject obj);
-
 #endif /* jsweakmap_h */
--- a/js/src/perf/jsperf.cpp
+++ b/js/src/perf/jsperf.cpp
@@ -169,17 +169,17 @@ static const JSClass pm_class = {
 
 static bool
 pm_construct(JSContext* cx, unsigned argc, jsval* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     uint32_t mask;
     if (!args.hasDefined(0)) {
-        js_ReportMissingArg(cx, args.calleev(), 0);
+        ReportMissingArg(cx, args.calleev(), 0);
         return false;
     }
     if (!JS::ToUint32(cx, args[0], &mask))
         return false;
 
     JS::RootedObject obj(cx, JS_NewObjectForConstructor(cx, &pm_class, args));
     if (!obj)
         return false;
@@ -208,28 +208,28 @@ pm_finalize(JSFreeOp* fop, JSObject* obj
 
 static PerfMeasurement*
 GetPM(JSContext* cx, JS::HandleValue value, const char* fname)
 {
     if (!value.isObject()) {
         char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, NullPtr());
         if (!bytes)
             return nullptr;
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, 0, JSMSG_NOT_NONNULL_OBJECT, bytes);
+        JS_ReportErrorNumber(cx, GetErrorMessage, 0, JSMSG_NOT_NONNULL_OBJECT, bytes);
         return nullptr;
     }
     RootedObject obj(cx, &value.toObject());
     PerfMeasurement* p = (PerfMeasurement*)
         JS_GetInstancePrivate(cx, obj, &pm_class, nullptr);
     if (p)
         return p;
 
     // JS_GetInstancePrivate only sets an exception if its last argument
     // is nonzero, so we have to do it by hand.
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, 0, JSMSG_INCOMPATIBLE_PROTO,
+    JS_ReportErrorNumber(cx, GetErrorMessage, 0, JSMSG_INCOMPATIBLE_PROTO,
                          pm_class.name, fname, JS_GetClass(obj)->name);
     return nullptr;
 }
 
 namespace JS {
 
 JSObject*
 RegisterPerfMeasurement(JSContext *cx, HandleObject globalArg)
--- a/js/src/proxy/BaseProxyHandler.cpp
+++ b/js/src/proxy/BaseProxyHandler.cpp
@@ -142,17 +142,17 @@ BaseProxyHandler::set(JSContext *cx, Han
     }
 
     // Step 6.
     MOZ_ASSERT(ownDesc.isAccessorDescriptor());
     RootedObject setter(cx);
     if (ownDesc.hasSetterObject())
         setter = ownDesc.setterObject();
     if (!setter)
-        return js_ReportGetterOnlyAssignment(cx, strict);
+        return ReportGetterOnlyAssignment(cx, strict);
     RootedValue setterValue(cx, ObjectValue(*setter));
     return InvokeGetterOrSetter(cx, receiver, setterValue, 1, vp.address(), vp);
 }
 
 bool
 js::SetPropertyIgnoringNamedGetter(JSContext *cx, const BaseProxyHandler *handler,
                                    HandleObject proxy, HandleObject receiver,
                                    HandleId id, MutableHandle<PropertyDescriptor> desc,
@@ -301,18 +301,18 @@ BaseProxyHandler::nativeCall(JSContext *
 }
 
 bool
 BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v,
                               bool *bp) const
 {
     assertEnteredPolicy(cx, proxy, JSID_VOID, GET);
     RootedValue val(cx, ObjectValue(*proxy.get()));
-    js_ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS,
-                        JSDVG_SEARCH_STACK, val, js::NullPtr());
+    ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS,
+                     JSDVG_SEARCH_STACK, val, js::NullPtr());
     return false;
 }
 
 bool
 BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) const
 {
     return false;
 }
@@ -345,32 +345,32 @@ BaseProxyHandler::getPrototypeOf(JSConte
 }
 
 bool
 BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) const
 {
     // Disallow sets of protos on proxies with lazy protos, but no hook.
     // This keeps us away from the footgun of having the first proto set opt
     // you out of having dynamic protos altogether.
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SETPROTOTYPEOF_FAIL,
                          "incompatible Proxy");
     return false;
 }
 
 bool
 BaseProxyHandler::setImmutablePrototype(JSContext *cx, HandleObject proxy, bool *succeeded) const
 {
     *succeeded = false;
     return true;
 }
 
 bool
 BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
                          proxy->getClass()->name);
     return false;
 }
 
 bool
 BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) const
 {
     return true;
--- a/js/src/proxy/DeadObjectProxy.cpp
+++ b/js/src/proxy/DeadObjectProxy.cpp
@@ -13,115 +13,115 @@
 
 using namespace js;
 using namespace js::gc;
 
 bool
 DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
                                        MutableHandle<PropertyDescriptor> desc) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
                                           MutableHandle<PropertyDescriptor> desc) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id,
                                 MutableHandle<PropertyDescriptor> desc) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::ownPropertyKeys(JSContext *cx, HandleObject wrapper,
                                  AutoIdVector &props) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, MutableHandleObject objp) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const
 {
     protop.set(nullptr);
     return true;
 }
 
 bool
 DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy, bool *succeeded) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const
 {
     // This is kind of meaningless, but dead-object semantics aside,
     // [[Extensible]] always being true is consistent with other proxy types.
     *extensible = true;
     return true;
 }
 
 bool
 DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
                             CallArgs args) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v,
                              bool *bp) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 const char *
 DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) const
 {
     return "DeadObject";
 }
@@ -130,25 +130,25 @@ JSString *
 DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const
 {
     return nullptr;
 }
 
 bool
 DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 bool
 DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint,
                               MutableHandleValue vp) const
 {
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
     return false;
 }
 
 const char DeadObjectProxy::family = 0;
 const DeadObjectProxy DeadObjectProxy::singleton;
 
 
 bool
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -30,30 +30,30 @@ using namespace js::gc;
 
 void
 js::AutoEnterPolicy::reportErrorIfExceptionIsNotPending(JSContext *cx, jsid id)
 {
     if (JS_IsExceptionPending(cx))
         return;
 
     if (JSID_IS_VOID(id)) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
                              JSMSG_OBJECT_ACCESS_DENIED);
     } else {
         RootedValue idVal(cx, IdToValue(id));
         JSString *str = ValueToSource(cx, idVal);
         if (!str) {
             return;
         }
         AutoStableStringChars chars(cx);
         const char16_t *prop = nullptr;
         if (str->ensureFlat(cx) && chars.initTwoByte(cx, str))
             prop = chars.twoByteChars();
 
-        JS_ReportErrorNumberUC(cx, js_GetErrorMessage, nullptr, JSMSG_PROPERTY_ACCESS_DENIED,
+        JS_ReportErrorNumberUC(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_ACCESS_DENIED,
                                prop);
     }
 }
 
 #ifdef DEBUG
 void
 js::AutoEnterPolicy::recordEnter(JSContext *cx, HandleObject proxy, HandleId id, Action act)
 {
@@ -749,17 +749,17 @@ ProxyObject::renew(JSContext *cx, const 
 
     setHandler(handler);
     setCrossCompartmentPrivate(priv);
     setExtra(0, UndefinedValue());
     setExtra(1, UndefinedValue());
 }
 
 JS_FRIEND_API(JSObject *)
-js_InitProxyClass(JSContext *cx, HandleObject obj)
+js::InitProxyClass(JSContext *cx, HandleObject obj)
 {
     static const JSFunctionSpec static_methods[] = {
         JS_FN("create",         proxy_create,          2, 0),
         JS_FN("createFunction", proxy_createFunction,  3, 0),
         JS_FN("revocable",      proxy_revocable,       2, 0),
         JS_FS_END
     };
 
--- a/js/src/proxy/ScriptedDirectProxyHandler.cpp
+++ b/js/src/proxy/ScriptedDirectProxyHandler.cpp
@@ -153,18 +153,18 @@ GetDirectProxyHandlerObject(JSObject *pr
 
 static inline void
 ReportInvalidTrapResult(JSContext *cx, JSObject *proxy, JSAtom *atom)
 {
     RootedValue v(cx, ObjectOrNullValue(proxy));
     JSAutoByteString bytes;
     if (!AtomToPrintableString(cx, atom, &bytes))
         return;
-    js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK, v,
-                         js::NullPtr(), bytes.ptr());
+    ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_IGNORE_STACK, v,
+                      js::NullPtr(), bytes.ptr());
 }
 
 // This function is shared between ownPropertyKeys, enumerate, and
 // getOwnEnumerablePropertyKeys.
 static bool
 ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleValue v,
                 AutoIdVector &props, unsigned flags, JSAtom *trapName_)
 {
@@ -202,17 +202,17 @@ ArrayToIdVector(JSContext *cx, HandleObj
         if (!HasOwnProperty(cx, target, id, &isFixed))
             return false;
 
         // step v
         bool extensible;
         if (!IsExtensible(cx, target, &extensible))
             return false;
         if (!extensible && !isFixed) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NEW);
             return false;
         }
 
         // step vi
         if (!props.append(id))
             return false;
     }
 
@@ -235,31 +235,31 @@ ArrayToIdVector(JSContext *cx, HandleObj
         if (found)
             continue;
 
         // step i
         bool sealed;
         if (!IsSealed(cx, target, id, &sealed))
             return false;
         if (sealed) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_SKIP_NC);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_SKIP_NC);
             return false;
         }
 
         // step ii
         bool isFixed;
         if (!HasOwnProperty(cx, target, id, &isFixed))
             return false;
 
         // step iii
         bool extensible;
         if (!IsExtensible(cx, target, &extensible))
             return false;
         if (!extensible && isFixed) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
             return false;
         }
     }
 
     // step n
     return true;
 }
 
@@ -267,60 +267,60 @@ ArrayToIdVector(JSContext *cx, HandleObj
 // 888969). For now, use these, to account for proxy revocation.
 bool
 ScriptedDirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy,
                                            MutableHandleObject protop) const
 {
     RootedObject target(cx, proxy->as<ProxyObject>().target());
     // Though handler is used elsewhere, spec mandates that both get set to null.
     if (!target) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     return DirectProxyHandler::getPrototypeOf(cx, proxy, protop);
 }
 
 bool
 ScriptedDirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy,
                                            HandleObject proto, bool *bp) const
 {
     RootedObject target(cx, proxy->as<ProxyObject>().target());
     if (!target) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     return DirectProxyHandler::setPrototypeOf(cx, proxy, proto, bp);
 }
 
 // Not yet part of ES6, but hopefully to be standards-tracked -- and needed to
 // handle revoked proxies in any event.
 bool
 ScriptedDirectProxyHandler::setImmutablePrototype(JSContext *cx, HandleObject proxy,
                                                   bool *succeeded) const
 {
     RootedObject target(cx, proxy->as<ProxyObject>().target());
     if (!target) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     return DirectProxyHandler::setImmutablePrototype(cx, proxy, succeeded);
 }
 
 // ES6 20141014 9.5.4 Proxy.[[PreventExtensions]]()
 bool
 ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy,
                                               bool *succeeded) const
 {
     // Steps 1-3.
     RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
     if (!handler) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     // Step 4.
     RootedObject target(cx, proxy->as<ProxyObject>().target());
 
     // Steps 5-6.
     RootedValue trap(cx);
@@ -343,17 +343,17 @@ ScriptedDirectProxyHandler::preventExten
     bool booleanTrapResult = ToBoolean(trapResult);
 
     // Step 11.
     if (booleanTrapResult) {
         bool extensible;
         if (!IsExtensible(cx, target, &extensible))
             return false;
         if (extensible) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_AS_NON_EXTENSIBLE);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_AS_NON_EXTENSIBLE);
             return false;
         }
     }
 
     // Step 12.
     *succeeded = booleanTrapResult;
     return true;
 }
@@ -362,17 +362,17 @@ ScriptedDirectProxyHandler::preventExten
 bool
 ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const
 {
     // step 1
     RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
 
     // step 2
     if (!handler) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     // step 3
     RootedObject target(cx, proxy->as<ProxyObject>().target());
 
     // step 4-5
     RootedValue trap(cx);
@@ -396,17 +396,17 @@ ScriptedDirectProxyHandler::isExtensible
 
     // step 10-11
     bool targetResult;
     if (!IsExtensible(cx, target, &targetResult))
         return false;
 
     // step 12
     if (targetResult != booleanTrapResult) {
-       JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_EXTENSIBILITY);
+       JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_EXTENSIBILITY);
        return false;
     }
 
     // step 13
     *extensible = booleanTrapResult;
     return true;
 }
 
@@ -437,17 +437,17 @@ bool
 ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                                      MutableHandle<PropertyDescriptor> desc) const
 {
     // step 2
     RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
 
     // step 3
     if (!handler) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     // step 4
     RootedObject target(cx, proxy->as<ProxyObject>().target());
 
     // step 5-6
     RootedValue trap(cx);
@@ -468,17 +468,17 @@ ScriptedDirectProxyHandler::getOwnProper
         propKey
     };
     RootedValue trapResult(cx);
     if (!Invoke(cx, ObjectValue(*handler), trap, ArrayLength(argv), argv, &trapResult))
         return false;
 
     // step 10
     if (!trapResult.isUndefined() && !trapResult.isObject()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_PROXY_GETOWN_OBJORUNDEF);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_PROXY_GETOWN_OBJORUNDEF);
         return false;
     }
 
     //step 11-12
     Rooted<PropertyDescriptor> targetDesc(cx);
     if (!GetOwnPropertyDescriptor(cx, target, id, &targetDesc))
         return false;
 
@@ -487,26 +487,26 @@ ScriptedDirectProxyHandler::getOwnProper
         // substep a
         if (!targetDesc.object()) {
             desc.object().set(nullptr);
             return true;
         }
 
         // substep b
         if (targetDesc.isPermanent()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NC_AS_NE);
             return false;
         }
 
         // substep c-e
         bool extensibleTarget;
         if (!IsExtensible(cx, target, &extensibleTarget))
             return false;
         if (!extensibleTarget) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
+            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_E_AS_NE);
             return false;
         }
 
         // substep f
         desc.object().set(nullptr);
         return true;
     }
 
@@ -525,29 +525,29 @@ ScriptedDirectProxyHandler::getOwnProper
 
     // step 19
     bool valid;
     if (!ValidatePropertyDescriptor(cx, extensibleTarget, resultDesc, targetDesc, &valid))
         return false;
 
     // step 20
     if (!valid) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_INVALID);
+        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CANT_REPORT_INVALID);
         return false;
     }
 
     // step 21
     if (!resultDesc.configurable()) {
         if (!targetDesc.object()) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REPORT_NE_AS_NC);
+            JS_ReportErrorNumber(cx, GetErrorMessag