Bug 879138 - Silence GCC warnings about inline functions used but not defined. r=njn.
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 04 Jun 2013 16:24:41 -0500
changeset 145467 c7c358d0beecd4e17b56fa19f0199cba6d9353f8
parent 145466 d94a84a5a0ac3c1ff69c02514a8ecc367b002bd3
child 145468 8ed346e399fed7a2022bddae67057f14fa793607
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs879138
milestone24.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 879138 - Silence GCC warnings about inline functions used but not defined. r=njn.
js/src/builtin/Module.cpp
js/src/builtin/Module.h
js/src/frontend/Parser.cpp
js/src/ion/AsmJS.cpp
js/src/jscntxt.h
js/src/jsobj.h
js/src/jsobjinlines.h
js/src/jsprvtd.h
js/src/jsscript.cpp
js/src/jsscript.h
js/src/vm/Debugger.cpp
js/src/vm/ScopeObject-inl.h
--- a/js/src/builtin/Module.cpp
+++ b/js/src/builtin/Module.cpp
@@ -16,18 +16,30 @@ Class js::ModuleClass = {
     JS_DeletePropertyStub,  /* delProperty */
     JS_PropertyStub,        /* getProperty */
     JS_StrictPropertyStub,  /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub
 };
 
+inline void
+Module::setAtom(JSAtom *atom)
+{
+    setReservedSlot(ATOM_SLOT, StringValue(atom));
+}
+
+inline void
+Module::setScript(JSScript *script)
+{
+    setReservedSlot(SCRIPT_SLOT, PrivateValue(script));
+}
+
 Module *
-js_NewModule(JSContext *cx, HandleAtom atom)
+Module::create(JSContext *cx, HandleAtom atom)
 {
     RootedObject object(cx, NewBuiltinClassInstance(cx, &ModuleClass));
     if (!object)
         return NULL;
     RootedModule module(cx, &object->asModule());
     module->setAtom(atom);
     module->setScript(NULL);
     return module;
--- a/js/src/builtin/Module.h
+++ b/js/src/builtin/Module.h
@@ -8,42 +8,36 @@
 #define Module_h___
 
 #include "jsobj.h"
 
 namespace js {
 
 class Module : public JSObject {
   public:
+    static Module *create(JSContext *cx, js::HandleAtom atom);
+
     JSAtom *atom() {
         return &getReservedSlot(ATOM_SLOT).toString()->asAtom();
     };
 
-    void setAtom(JSAtom *atom) {
-        setReservedSlot(ATOM_SLOT, StringValue(atom));
-    };
-
     JSScript *script() {
         return (JSScript *) getReservedSlot(SCRIPT_SLOT).toPrivate();
     }
 
-    void setScript(JSScript *script) {
-        setReservedSlot(SCRIPT_SLOT, PrivateValue(script));
-    }
+  private:
+    inline void setAtom(JSAtom *atom);
+    inline void setScript(JSScript *script);
 
-  private:
     static const uint32_t ATOM_SLOT = 0;
     static const uint32_t SCRIPT_SLOT = 1;
 };
 
 } // namespace js
 
-js::Module *
-js_NewModule(JSContext *cx, js::HandleAtom atom);
-
 inline js::Module &
 JSObject::asModule()
 {
     JS_ASSERT(isModule());
     return *static_cast<js::Module *>(this);
 }
 
 #endif // Module_h___
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -2334,17 +2334,17 @@ Parser<FullParseHandler>::moduleDecl()
         return NULL;
     }
 
     ParseNode *pn = CodeNode::create(PNK_MODULE, &handler);
     if (!pn)
         return NULL;
     JS_ALWAYS_TRUE(tokenStream.matchToken(TOK_STRING));
     RootedAtom atom(context, tokenStream.currentToken().atom());
-    Module *module = js_NewModule(context, atom);
+    Module *module = Module::create(context, atom);
     if (!module)
         return NULL;
     ModuleBox *modulebox = newModuleBox(module, pc);
     if (!modulebox)
         return NULL;
     pn->pn_modulebox = modulebox;
 
     ParseContext<FullParseHandler> modulepc(this, pc, modulebox, pc->staticLevel + 1, pc->blockidGen);
--- a/js/src/ion/AsmJS.cpp
+++ b/js/src/ion/AsmJS.cpp
@@ -6,16 +6,17 @@
 
 #include "jsmath.h"
 #include "jsworkers.h"
 
 #include "frontend/ParseNode.h"
 #include "ion/AsmJS.h"
 #include "ion/AsmJSModule.h"
 
+#include "jsobjinlines.h"
 #include "frontend/ParseNode-inl.h"
 
 using namespace js;
 using namespace js::frontend;
 using namespace mozilla;
 
 #include "ion/PerfSpewer.h"
 #include "ion/CodeGenerator.h"
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -606,18 +606,16 @@ struct MallocProvider
 
     JS_DECLARE_NEW_METHODS(new_, malloc_, JS_ALWAYS_INLINE)
 };
 
 namespace gc {
 class MarkingValidator;
 } // namespace gc
 
-class JS_FRIEND_API(AutoEnterPolicy);
-
 typedef Vector<JS::Zone *, 1, SystemAllocPolicy> ZoneVector;
 
 } // namespace js
 
 struct JSRuntime : public JS::shadow::Runtime,
                    public js::MallocProvider<JSRuntime>
 {
     /*
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -256,16 +256,18 @@ class SetIteratorObject;
 class StaticBlockObject;
 class StrictArgumentsObject;
 class StringObject;
 class RegExpObject;
 class WithObject;
 
 }  /* namespace js */
 
+#define JSSLOT_FREE(clasp)  JSCLASS_RESERVED_SLOTS(clasp)
+
 /*
  * The public interface for an object.
  *
  * Implementation of the underlying structure occurs in ObjectImpl, from which
  * this struct inherits.  This inheritance is currently public, but it will
  * eventually be made protected.  For full details, see vm/ObjectImpl.{h,cpp}.
  *
  * The JSFunction struct is an extension of this struct allocated from a larger
@@ -417,18 +419,26 @@ class JSObject : public js::ObjectImpl
     inline void prepareElementRangeForOverwrite(size_t start, size_t end);
 
     void rollbackProperties(JSContext *cx, uint32_t slotSpan);
 
     inline void nativeSetSlot(uint32_t slot, const js::Value &value);
     static inline void nativeSetSlotWithType(JSContext *cx, js::HandleObject, js::Shape *shape,
                                              const js::Value &value);
 
-    inline const js::Value &getReservedSlot(uint32_t index) const;
-    inline js::HeapSlot &getReservedSlotRef(uint32_t index);
+    inline const js::Value &getReservedSlot(uint32_t index) const {
+        JS_ASSERT(index < JSSLOT_FREE(getClass()));
+        return getSlot(index);
+    }
+
+    inline js::HeapSlot &getReservedSlotRef(uint32_t index) {
+        JS_ASSERT(index < JSSLOT_FREE(getClass()));
+        return getSlotRef(index);
+    }
+
     inline void initReservedSlot(uint32_t index, const js::Value &v);
     inline void setReservedSlot(uint32_t index, const js::Value &v);
 
     /*
      * Marks this object as having a singleton type, and leave the type lazy.
      * Constructs a new, unique shape for the object.
      */
     static inline bool setSingletonType(JSContext *cx, js::HandleObject obj);
@@ -1078,18 +1088,16 @@ operator!=(const JSObject &lhs, const JS
 }
 
 struct JSObject_Slots2 : JSObject { js::Value fslots[2]; };
 struct JSObject_Slots4 : JSObject { js::Value fslots[4]; };
 struct JSObject_Slots8 : JSObject { js::Value fslots[8]; };
 struct JSObject_Slots12 : JSObject { js::Value fslots[12]; };
 struct JSObject_Slots16 : JSObject { js::Value fslots[16]; };
 
-#define JSSLOT_FREE(clasp)  JSCLASS_RESERVED_SLOTS(clasp)
-
 class JSValueArray {
   public:
     jsval *array;
     size_t length;
 
     JSValueArray(jsval *v, size_t c) : array(v), length(c) {}
 };
 
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -320,30 +320,16 @@ JSObject::canRemoveLastProperty()
 
 inline const js::HeapSlot *
 JSObject::getRawSlots()
 {
     JS_ASSERT(isGlobal());
     return slots;
 }
 
-inline const js::Value &
-JSObject::getReservedSlot(uint32_t index) const
-{
-    JS_ASSERT(index < JSSLOT_FREE(getClass()));
-    return getSlot(index);
-}
-
-inline js::HeapSlot &
-JSObject::getReservedSlotRef(uint32_t index)
-{
-    JS_ASSERT(index < JSSLOT_FREE(getClass()));
-    return getSlotRef(index);
-}
-
 inline void
 JSObject::setReservedSlot(uint32_t index, const js::Value &v)
 {
     JS_ASSERT(index < JSSLOT_FREE(getClass()));
     setSlot(index, v);
 }
 
 inline void
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -104,16 +104,17 @@ class StringBuffer;
 class FrameRegs;
 class StackFrame;
 class StackSegment;
 class StackSpace;
 class ContextStack;
 class ScriptFrameIter;
 
 class Proxy;
+class JS_FRIEND_API(AutoEnterPolicy);
 class JS_FRIEND_API(BaseProxyHandler);
 class JS_FRIEND_API(Wrapper);
 class JS_FRIEND_API(CrossCompartmentWrapper);
 
 class TempAllocPolicy;
 class RuntimeAllocPolicy;
 
 class GlobalObject;
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -891,16 +891,26 @@ JSScript::destroyScriptCounts(FreeOp *fo
 {
     if (hasScriptCounts) {
         ScriptCounts scriptCounts = releaseScriptCounts();
         scriptCounts.destroy(fop);
     }
 }
 
 void
+ScriptSourceObject::setSource(ScriptSource *source)
+{
+    if (source)
+        source->incref();
+    if (this->source())
+        this->source()->decref();
+    setReservedSlot(SOURCE_SLOT, PrivateValue(source));
+}
+
+void
 ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
 {
     // ScriptSource::setSource automatically takes care of the refcount
     obj->asScriptSource().setSource(NULL);
 }
 
 Class js::ScriptSourceClass = {
     "ScriptSource",
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1097,23 +1097,17 @@ class ScriptSourceObject : public JSObje
   public:
     static void finalize(FreeOp *fop, JSObject *obj);
     static ScriptSourceObject *create(JSContext *cx, ScriptSource *source);
 
     ScriptSource *source() {
         return static_cast<ScriptSource *>(getReservedSlot(SOURCE_SLOT).toPrivate());
     }
 
-    void setSource(ScriptSource *source) {
-        if (source)
-            source->incref();
-        if (this->source())
-            this->source()->decref();
-        setReservedSlot(SOURCE_SLOT, PrivateValue(source));
-    }
+    void setSource(ScriptSource *source);
 
   private:
     static const uint32_t SOURCE_SLOT = 0;
 };
 
 // Information about a script which may be (or has been) lazily compiled to
 // bytecode from its source.
 class LazyScript : public js::gc::Cell
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1,33 +1,34 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
+#include "vm/Debugger.h"
+
 #include <limits.h>
 
-#include "vm/Debugger.h"
 #include "jsapi.h"
 #include "jscntxt.h"
+#include "jscompartment.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jswrapper.h"
-#include "jsgcinlines.h"
-#include "jsobjinlines.h"
-#include "jsopcodeinlines.h"
-#include "jscompartment.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/BytecodeEmitter.h"
 #include "gc/Marking.h"
 #include "ion/BaselineJIT.h"
 #include "js/Vector.h"
 
+#include "jsgcinlines.h"
+#include "jsobjinlines.h"
+#include "jsopcodeinlines.h"
 #include "gc/FindSCCs-inl.h"
 #include "vm/Interpreter-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 
 using js::frontend::IsIdentifier;
 using mozilla::ArrayLength;
--- a/js/src/vm/ScopeObject-inl.h
+++ b/js/src/vm/ScopeObject-inl.h
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ScopeObject_inl_h___
 #define ScopeObject_inl_h___
 
 #include "ScopeObject.h"
 
 #include "jsinferinlines.h"
+#include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 namespace js {
 
 inline
 ScopeCoordinate::ScopeCoordinate(jsbytecode *pc)
   : hops(GET_UINT16(pc)), slot(GET_UINT16(pc + 2))
 {