Bug 717278 - Vector should have const and non-const begin(). r=luke.
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 20 Jan 2012 06:11:42 -0600
changeset 86216 11ba93db719a7e3ee2b61fb1036bcbde2545e78c
parent 86215 65d66257a1767cf4aead53dba5af2db71b2b2f10
child 86217 bd3c52671d7455ce4bb88b5b618e649407da057a
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs717278
milestone12.0a1
Bug 717278 - Vector should have const and non-const begin(). r=luke.
js/public/Vector.h
js/src/methodjit/PolyIC.cpp
js/src/vm/Debugger.cpp
--- a/js/public/Vector.h
+++ b/js/public/Vector.h
@@ -344,17 +344,22 @@ class Vector : private AllocPolicy
     bool empty() const {
         return mLength == 0;
     }
 
     size_t capacity() const {
         return mCapacity;
     }
 
-    T *begin() const {
+    T *begin() {
+        JS_ASSERT(!entered);
+        return mBegin;
+    }
+
+    const T *begin() const {
         JS_ASSERT(!entered);
         return mBegin;
     }
 
     T *end() {
         JS_ASSERT(!entered);
         return mBegin + mLength;
     }
--- a/js/src/methodjit/PolyIC.cpp
+++ b/js/src/methodjit/PolyIC.cpp
@@ -1121,17 +1121,17 @@ class GetPropCompiler : public PICStubCo
         repatcher.patchAddressOffsetForValueLoad(labels.getValueLoad(pic.fastPathRejoin), offset);
 
         pic.inlinePathPatched = true;
 
         return Lookup_Cacheable;
     }
 
     void generateGetterStub(Assembler &masm, const Shape *shape,
-                            Label start, const Vector<Jump, 8> &shapeMismatches)
+                            Label start, Vector<Jump, 8> &shapeMismatches)
     {
         /*
          * Getter hook needs to be called from the stub. The state is fully
          * synced and no registers are live except the result registers.
          */
         JS_ASSERT(pic.canCallHook);
         PropertyOp getter = shape->getterOp();
 
@@ -1299,17 +1299,17 @@ class GetPropCompiler : public PICStubCo
 
         linkerEpilogue(buffer, start, shapeMismatches);
 
         if (setStubShapeOffset)
             pic.getPropLabels().setStubShapeJump(masm, start, stubShapeJumpLabel);
         return Lookup_Cacheable;
     }
 
-    void linkerEpilogue(LinkerHelper &buffer, Label start, const Vector<Jump, 8> &shapeMismatches)
+    void linkerEpilogue(LinkerHelper &buffer, Label start, Vector<Jump, 8> &shapeMismatches)
     {
         // The guard exit jumps to the original slow case.
         for (Jump *pj = shapeMismatches.begin(); pj != shapeMismatches.end(); ++pj)
             buffer.link(*pj, pic.slowPathStart);
 
         CodeLocationLabel cs = buffer.finalize(f);
         JaegerSpew(JSpew_PICs, "generated %s stub at %p\n", type, cs.executableAddress());
 
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1161,17 +1161,17 @@ Debugger::markAllIteratively(GCMarker *t
             GlobalObject *global = r.front();
 
             /*
              * Every debuggee has at least one debugger, so in this case
              * getDebuggers can't return NULL.
              */
             const GlobalObject::DebuggerVector *debuggers = global->getDebuggers();
             JS_ASSERT(debuggers);
-            for (Debugger **p = debuggers->begin(); p != debuggers->end(); p++) {
+            for (Debugger * const *p = debuggers->begin(); p != debuggers->end(); p++) {
                 Debugger *dbg = *p;
 
                 /*
                  * dbg is a Debugger with at least one debuggee. Check three things:
                  *   - dbg is actually in a compartment being GC'd
                  *   - it isn't already marked
                  *   - it actually has hooks that might be called
                  */