Bug 895723 - Don't open the mozilla namespace in AsmJS.cpp -- use particular things from it instead. This eases the pain of dealing with js/mozilla namespace conflicts, particularly for Vector. r=luke
authorJeff Walden <jwalden@mit.edu>
Fri, 19 Jul 2013 13:05:10 -0700
changeset 151622 02e9ac646def047ce411227f41d1e4643ae1c859
parent 151621 612b03080cb034bb3295a084d7ebe2a7c6de20fa
child 151623 e4ed450913fe652646e4238a5166d49d8c4fc686
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs895723
milestone25.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 895723 - Don't open the mozilla namespace in AsmJS.cpp -- use particular things from it instead. This eases the pain of dealing with js/mozilla namespace conflicts, particularly for Vector. r=luke
js/src/ion/AsmJS.cpp
--- a/js/src/ion/AsmJS.cpp
+++ b/js/src/ion/AsmJS.cpp
@@ -29,17 +29,25 @@
 
 #ifdef MOZ_VTUNE
 # include "jitprofiling.h"
 #endif
 
 using namespace js;
 using namespace js::frontend;
 using namespace js::ion;
-using namespace mozilla;
+
+using mozilla::AddToHash;
+using mozilla::ArrayLength;
+using mozilla::DebugOnly;
+using mozilla::HashGeneric;
+using mozilla::IsNegativeZero;
+using mozilla::Maybe;
+using mozilla::Move;
+using mozilla::MoveRef;
 
 static const size_t LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 1 << 12;
 
 /*****************************************************************************/
 // ParseNode utilities
 
 static inline ParseNode *
 NextNode(ParseNode *pn)
@@ -620,20 +628,20 @@ class ABIArgIter
     ABIArg *operator->() { JS_ASSERT(!done()); return &gen_.current(); }
     ABIArg &operator*() { JS_ASSERT(!done()); return gen_.current(); }
 
     unsigned index() const { JS_ASSERT(!done()); return i_; }
     MIRType mirType() const { JS_ASSERT(!done()); return ToMIRType(types_[i_]); }
     uint32_t stackBytesConsumedSoFar() const { return gen_.stackBytesConsumedSoFar(); }
 };
 
-typedef js::Vector<MIRType, 8> MIRTypeVector;
+typedef Vector<MIRType, 8> MIRTypeVector;
 typedef ABIArgIter<MIRTypeVector> ABIArgMIRTypeIter;
 
-typedef js::Vector<VarType, 8> VarTypeVector;
+typedef Vector<VarType, 8> VarTypeVector;
 typedef ABIArgIter<VarTypeVector> ABIArgTypeIter;
 
 class Signature
 {
     VarTypeVector argTypes_;
     RetType retType_;
 
   public:
@@ -862,18 +870,18 @@ TypedArrayStoreType(ArrayBufferView::Vie
         return ArrayStore_Doublish;
       default:;
     }
     MOZ_ASSUME_UNREACHABLE("Unexpected array type");
 }
 
 /*****************************************************************************/
 
-typedef js::Vector<PropertyName*,1> LabelVector;
-typedef js::Vector<MBasicBlock*,8> BlockVector;
+typedef Vector<PropertyName*,1> LabelVector;
+typedef Vector<MBasicBlock*,8> BlockVector;
 
 // ModuleCompiler encapsulates the compilation of an entire asm.js module. Over
 // the course of an ModuleCompiler object's lifetime, many FunctionCompiler
 // objects will be created and destroyed in sequence, one for each function in
 // the module.
 //
 // *** asm.js FFI calls ***
 //
@@ -1018,17 +1026,17 @@ class MOZ_STACK_CLASS ModuleCompiler
             return u.mathBuiltin_;
         }
         double constant() const {
             JS_ASSERT(which_ == Constant);
             return u.constant_;
         }
     };
 
-    typedef js::Vector<const Func*> FuncPtrVector;
+    typedef Vector<const Func*> FuncPtrVector;
 
     class FuncPtrTable
     {
         Signature sig_;
         uint32_t mask_;
         uint32_t globalDataOffset_;
         FuncPtrVector elems_;
 
@@ -1046,17 +1054,17 @@ class MOZ_STACK_CLASS ModuleCompiler
         unsigned mask() const { return mask_; }
         unsigned globalDataOffset() const { return globalDataOffset_; }
 
         void initElems(MoveRef<FuncPtrVector> elems) { elems_ = elems; JS_ASSERT(!elems_.empty()); }
         unsigned numElems() const { JS_ASSERT(!elems_.empty()); return elems_.length(); }
         const Func &elem(unsigned i) const { return *elems_[i]; }
     };
 
-    typedef js::Vector<FuncPtrTable> FuncPtrTableVector;
+    typedef Vector<FuncPtrTable> FuncPtrTableVector;
 
     class ExitDescriptor
     {
         PropertyName *name_;
         Signature sig_;
 
       public:
         ExitDescriptor(PropertyName *name, MoveRef<Signature> sig)
@@ -1090,19 +1098,19 @@ class MOZ_STACK_CLASS ModuleCompiler
         PropertyName *name;
         unsigned ms;
         unsigned line;
         unsigned column;
     };
 
     typedef HashMap<PropertyName*, AsmJSMathBuiltin> MathNameMap;
     typedef HashMap<PropertyName*, Global*> GlobalMap;
-    typedef js::Vector<Func*> FuncVector;
-    typedef js::Vector<AsmJSGlobalAccess> GlobalAccessVector;
-    typedef js::Vector<SlowFunction> SlowFunctionVector;
+    typedef Vector<Func*> FuncVector;
+    typedef Vector<AsmJSGlobalAccess> GlobalAccessVector;
+    typedef Vector<SlowFunction> SlowFunctionVector;
 
     JSContext *                    cx_;
     AsmJSParser &                  parser_;
 
     MacroAssembler                 masm_;
 
     ScopedJSDeletePtr<AsmJSModule> module_;
     LifoAlloc                      moduleLifo_;
@@ -1624,20 +1632,20 @@ class FunctionCompiler
     {
         VarType type;
         unsigned slot;
         Local(VarType t, unsigned slot) : type(t), slot(slot) {}
     };
 
   private:
     typedef HashMap<PropertyName*, Local> LocalMap;
-    typedef js::Vector<Value> VarInitializerVector;
+    typedef Vector<Value> VarInitializerVector;
     typedef HashMap<PropertyName*, BlockVector> LabeledBlockMap;
     typedef HashMap<ParseNode*, BlockVector> UnlabeledBlockMap;
-    typedef js::Vector<ParseNode*, 4> NodeStack;
+    typedef Vector<ParseNode*, 4> NodeStack;
 
     ModuleCompiler &       m_;
     LifoAlloc &            lifo_;
     ParseNode *            fn_;
 
     LocalMap               locals_;
     VarInitializerVector   varInitializers_;
     Maybe<RetType>         alreadyReturned_;
@@ -1971,17 +1979,17 @@ class FunctionCompiler
     class Call
     {
         ABIArgGenerator abi_;
         uint32_t prevMaxStackBytes_;
         uint32_t maxChildStackBytes_;
         uint32_t spIncrement_;
         Signature sig_;
         MAsmJSCall::Args regArgs_;
-        js::Vector<MAsmJSPassStackArg*> stackArgs_;
+        Vector<MAsmJSPassStackArg*> stackArgs_;
         bool childClobbers_;
 
         friend class FunctionCompiler;
 
       public:
         Call(FunctionCompiler &f, RetType retType)
           : prevMaxStackBytes_(0),
             maxChildStackBytes_(0),
@@ -4871,21 +4879,21 @@ CheckFunctionsSequential(ModuleCompiler 
     return true;
 }
 
 #ifdef JS_WORKER_THREADS
 // State of compilation as tracked and updated by the main thread.
 struct ParallelGroupState
 {
     WorkerThreadState &state;
-    js::Vector<AsmJSParallelTask> &tasks;
+    Vector<AsmJSParallelTask> &tasks;
     int32_t outstandingJobs; // Good work, jobs!
     uint32_t compiledJobs;
 
-    ParallelGroupState(WorkerThreadState &state, js::Vector<AsmJSParallelTask> &tasks)
+    ParallelGroupState(WorkerThreadState &state, Vector<AsmJSParallelTask> &tasks)
       : state(state), tasks(tasks), outstandingJobs(0), compiledJobs(0)
     { }
 };
 
 // Block until a worker-assigned LifoAlloc becomes finished.
 static AsmJSParallelTask *
 GetFinishedCompilation(ModuleCompiler &m, ParallelGroupState &group)
 {
@@ -5035,17 +5043,17 @@ static bool
 CheckFunctionsParallel(ModuleCompiler &m)
 {
     // Saturate all worker threads plus the main thread.
     WorkerThreadState &state = *m.cx()->runtime()->workerThreadState;
     size_t numParallelJobs = state.numThreads + 1;
 
     // Allocate scoped AsmJSParallelTask objects. Each contains a unique
     // LifoAlloc that provides all necessary memory for compilation.
-    js::Vector<AsmJSParallelTask, 0> tasks(m.cx());
+    Vector<AsmJSParallelTask, 0> tasks(m.cx());
     if (!tasks.initCapacity(numParallelJobs))
         return false;
 
     for (size_t i = 0; i < numParallelJobs; i++)
         tasks.infallibleAppend(LIFO_ALLOC_PARALLEL_CHUNK_SIZE);
 
     // With compilation memory in-scope, dispatch worker threads.
     ParallelGroupState group(state, tasks);