Bug 717278 - Vector should have const and non-const begin(). r=luke.
--- 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
*/