зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1238711 - Rename TraceableVector to GCVector; r=sfink
--HG-- rename : js/public/TraceableVector.h => js/public/GCVector.h
This commit is contained in:
Родитель
71921c1eac
Коммит
b8876546d0
|
@ -4,8 +4,8 @@
|
|||
* 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 js_TraceableVector_h
|
||||
#define js_TraceableVector_h
|
||||
#ifndef js_GCVector_h
|
||||
#define js_GCVector_h
|
||||
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace js {
|
||||
|
||||
// A TraceableVector is a Vector with an additional trace method that knows how
|
||||
// A GCVector is a Vector with an additional trace method that knows how
|
||||
// to visit all of the items stored in the Vector. For vectors that contain GC
|
||||
// things, this is usually more convenient than manually iterating and marking
|
||||
// the contents.
|
||||
|
@ -33,20 +33,20 @@ template <typename T,
|
|||
size_t MinInlineCapacity = 0,
|
||||
typename AllocPolicy = TempAllocPolicy,
|
||||
typename GCPolicy = DefaultGCPolicy<T>>
|
||||
class TraceableVector : public JS::Traceable
|
||||
class GCVector : public JS::Traceable
|
||||
{
|
||||
mozilla::Vector<T, MinInlineCapacity, AllocPolicy> vector;
|
||||
|
||||
public:
|
||||
explicit TraceableVector(AllocPolicy alloc = AllocPolicy())
|
||||
explicit GCVector(AllocPolicy alloc = AllocPolicy())
|
||||
: vector(alloc)
|
||||
{}
|
||||
|
||||
TraceableVector(TraceableVector&& vec)
|
||||
GCVector(GCVector&& vec)
|
||||
: vector(mozilla::Move(vec.vector))
|
||||
{}
|
||||
|
||||
TraceableVector& operator=(TraceableVector&& vec) {
|
||||
GCVector& operator=(GCVector&& vec) {
|
||||
vector = mozilla::Move(vec.vector);
|
||||
return *this;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class TraceableVector : public JS::Traceable
|
|||
return vector.sizeOfIncludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
static void trace(TraceableVector* vec, JSTracer* trc) { vec->trace(trc); }
|
||||
static void trace(GCVector* vec, JSTracer* trc) { vec->trace(trc); }
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
for (auto& elem : vector)
|
||||
|
@ -127,9 +127,9 @@ class TraceableVector : public JS::Traceable
|
|||
};
|
||||
|
||||
template <typename Outer, typename T, size_t Capacity, typename AllocPolicy, typename GCPolicy>
|
||||
class TraceableVectorOperations
|
||||
class GCVectorOperations
|
||||
{
|
||||
using Vec = TraceableVector<T, Capacity, AllocPolicy, GCPolicy>;
|
||||
using Vec = GCVector<T, Capacity, AllocPolicy, GCPolicy>;
|
||||
const Vec& vec() const { return static_cast<const Outer*>(this)->get(); }
|
||||
|
||||
public:
|
||||
|
@ -147,10 +147,10 @@ class TraceableVectorOperations
|
|||
};
|
||||
|
||||
template <typename Outer, typename T, size_t Capacity, typename AllocPolicy, typename GCPolicy>
|
||||
class MutableTraceableVectorOperations
|
||||
: public TraceableVectorOperations<Outer, T, Capacity, AllocPolicy, GCPolicy>
|
||||
class MutableGCVectorOperations
|
||||
: public GCVectorOperations<Outer, T, Capacity, AllocPolicy, GCPolicy>
|
||||
{
|
||||
using Vec = TraceableVector<T, Capacity, AllocPolicy, GCPolicy>;
|
||||
using Vec = GCVector<T, Capacity, AllocPolicy, GCPolicy>;
|
||||
const Vec& vec() const { return static_cast<const Outer*>(this)->get(); }
|
||||
Vec& vec() { return static_cast<Outer*>(this)->get(); }
|
||||
|
||||
|
@ -214,27 +214,27 @@ class MutableTraceableVectorOperations
|
|||
};
|
||||
|
||||
template <typename T, size_t N, typename AP, typename GP>
|
||||
class RootedBase<TraceableVector<T,N,AP,GP>>
|
||||
: public MutableTraceableVectorOperations<JS::Rooted<TraceableVector<T,N,AP,GP>>, T,N,AP,GP>
|
||||
class RootedBase<GCVector<T,N,AP,GP>>
|
||||
: public MutableGCVectorOperations<JS::Rooted<GCVector<T,N,AP,GP>>, T,N,AP,GP>
|
||||
{};
|
||||
|
||||
template <typename T, size_t N, typename AP, typename GP>
|
||||
class MutableHandleBase<TraceableVector<T,N,AP,GP>>
|
||||
: public MutableTraceableVectorOperations<JS::MutableHandle<TraceableVector<T,N,AP,GP>>,
|
||||
class MutableHandleBase<GCVector<T,N,AP,GP>>
|
||||
: public MutableGCVectorOperations<JS::MutableHandle<GCVector<T,N,AP,GP>>,
|
||||
T,N,AP,GP>
|
||||
{};
|
||||
|
||||
template <typename T, size_t N, typename AP, typename GP>
|
||||
class HandleBase<TraceableVector<T,N,AP,GP>>
|
||||
: public TraceableVectorOperations<JS::Handle<TraceableVector<T,N,AP,GP>>, T,N,AP,GP>
|
||||
class HandleBase<GCVector<T,N,AP,GP>>
|
||||
: public GCVectorOperations<JS::Handle<GCVector<T,N,AP,GP>>, T,N,AP,GP>
|
||||
{};
|
||||
|
||||
template <typename T, size_t N, typename AP, typename GP>
|
||||
class PersistentRootedBase<TraceableVector<T,N,AP,GP>>
|
||||
: public MutableTraceableVectorOperations<JS::PersistentRooted<TraceableVector<T,N,AP,GP>>,
|
||||
class PersistentRootedBase<GCVector<T,N,AP,GP>>
|
||||
: public MutableGCVectorOperations<JS::PersistentRooted<GCVector<T,N,AP,GP>>,
|
||||
T,N,AP,GP>
|
||||
{};
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif // js_TraceableVector_h
|
||||
#endif // js_GCVector_h
|
|
@ -13,7 +13,7 @@
|
|||
// These includes are needed these for some typedefs (e.g. HandleValue) and
|
||||
// functions (e.g. NullValue())...
|
||||
#include "js/CallNonGenericMethod.h"
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "js/Value.h"
|
||||
|
||||
|
@ -36,9 +36,9 @@ typedef AutoVectorRooter<jsid> AutoIdVector;
|
|||
typedef AutoVectorRooter<JSObject*> AutoObjectVector;
|
||||
typedef AutoVectorRooter<JSScript*> AutoVector;
|
||||
|
||||
using ValueVector = js::TraceableVector<JS::Value>;
|
||||
using IdVector = js::TraceableVector<jsid>;
|
||||
using ScriptVector = js::TraceableVector<JSScript*>;
|
||||
using ValueVector = js::GCVector<JS::Value>;
|
||||
using IdVector = js::GCVector<jsid>;
|
||||
using ScriptVector = js::GCVector<JSScript*>;
|
||||
|
||||
template <typename T> class AutoVectorRooter;
|
||||
template<typename K, typename V> class AutoHashMapRooter;
|
||||
|
|
|
@ -1166,7 +1166,7 @@ MakeElementValue(JSObject *object)
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
ArrayObject* ModuleBuilder::createArray(const TraceableVector<T>& vector)
|
||||
ArrayObject* ModuleBuilder::createArray(const GCVector<T>& vector)
|
||||
{
|
||||
uint32_t length = vector.length();
|
||||
RootedArrayObject array(cx_, NewDenseFullyAllocatedArray(cx_, length));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "gc/Zone.h"
|
||||
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/GCVector.h"
|
||||
|
||||
#include "vm/NativeObject.h"
|
||||
#include "vm/ProxyObject.h"
|
||||
|
@ -196,7 +196,7 @@ struct FunctionDeclaration
|
|||
RelocatablePtrFunction fun;
|
||||
};
|
||||
|
||||
using FunctionDeclarationVector = TraceableVector<FunctionDeclaration, 0, ZoneAllocPolicy>;
|
||||
using FunctionDeclarationVector = GCVector<FunctionDeclaration, 0, ZoneAllocPolicy>;
|
||||
|
||||
class ModuleObject : public NativeObject
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ class MOZ_STACK_CLASS ModuleBuilder
|
|||
|
||||
bool hasExportedName(JSAtom* name) const;
|
||||
|
||||
using ExportEntryVector = TraceableVector<ExportEntryObject*>;
|
||||
using ExportEntryVector = GCVector<ExportEntryObject*>;
|
||||
const ExportEntryVector& localExportEntries() const {
|
||||
return localExportEntries_;
|
||||
}
|
||||
|
@ -291,9 +291,9 @@ class MOZ_STACK_CLASS ModuleBuilder
|
|||
bool initModule();
|
||||
|
||||
private:
|
||||
using AtomVector = TraceableVector<JSAtom*>;
|
||||
using AtomVector = GCVector<JSAtom*>;
|
||||
using RootedAtomVector = JS::Rooted<AtomVector>;
|
||||
using ImportEntryVector = TraceableVector<ImportEntryObject*>;
|
||||
using ImportEntryVector = GCVector<ImportEntryObject*>;
|
||||
using RootedImportEntryVector = JS::Rooted<ImportEntryVector>;
|
||||
using RootedExportEntryVector = JS::Rooted<ExportEntryVector>;
|
||||
|
||||
|
@ -316,7 +316,7 @@ class MOZ_STACK_CLASS ModuleBuilder
|
|||
bool maybeAppendRequestedModule(HandleAtom module);
|
||||
|
||||
template <typename T>
|
||||
ArrayObject* createArray(const TraceableVector<T>& vector);
|
||||
ArrayObject* createArray(const GCVector<T>& vector);
|
||||
};
|
||||
|
||||
bool InitModuleClasses(JSContext* cx, HandleObject obj);
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#include "NamespaceImports.h"
|
||||
#include "gc/Tracer.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/Id.h"
|
||||
#include "js/TraceableVector.h"
|
||||
|
||||
namespace js {
|
||||
|
||||
|
@ -37,7 +37,7 @@ struct IdValuePair
|
|||
}
|
||||
};
|
||||
|
||||
using IdValueVector = TraceableVector<IdValuePair>;
|
||||
using IdValueVector = GCVector<IdValuePair>;
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ struct MOZ_STACK_CLASS ParseContext : public GenericParseContext
|
|||
OwnedAtomDefnMapPtr lexdeps; /* unresolved lexical name dependencies */
|
||||
|
||||
// All inner functions in this context. Only filled in when parsing syntax.
|
||||
Rooted<TraceableVector<JSFunction*>> innerFunctions;
|
||||
Rooted<GCVector<JSFunction*>> innerFunctions;
|
||||
|
||||
// In a function context, points to a Directive struct that can be updated
|
||||
// to reflect new directives encountered in the Directive Prologue that
|
||||
|
@ -272,7 +272,7 @@ struct MOZ_STACK_CLASS ParseContext : public GenericParseContext
|
|||
parserPC(&prs->pc),
|
||||
oldpc(prs->pc),
|
||||
lexdeps(prs->context),
|
||||
innerFunctions(prs->context, TraceableVector<JSFunction*>(prs->context)),
|
||||
innerFunctions(prs->context, GCVector<JSFunction*>(prs->context)),
|
||||
newDirectives(newDirectives),
|
||||
inDeclDestructuring(false)
|
||||
{
|
||||
|
|
|
@ -55,10 +55,10 @@ typedef JS::Rooted<PlainObject*> RootedPlainObject;
|
|||
typedef JS::Rooted<SavedFrame*> RootedSavedFrame;
|
||||
typedef JS::Rooted<ScriptSourceObject*> RootedScriptSource;
|
||||
|
||||
typedef TraceableVector<JSFunction*> FunctionVector;
|
||||
typedef TraceableVector<PropertyName*> PropertyNameVector;
|
||||
typedef TraceableVector<Shape*> ShapeVector;
|
||||
typedef TraceableVector<JSString*> StringVector;
|
||||
typedef GCVector<JSFunction*> FunctionVector;
|
||||
typedef GCVector<PropertyName*> PropertyNameVector;
|
||||
typedef GCVector<Shape*> ShapeVector;
|
||||
typedef GCVector<JSString*> StringVector;
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "jit/SharedICHelpers.h"
|
||||
#include "jit/VMFunctions.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "vm/Opcodes.h"
|
||||
#include "vm/TypedArrayCommon.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "jit/BaselineJIT.h"
|
||||
#include "jit/SharedIC.h"
|
||||
#include "jit/SharedICRegisters.h"
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "vm/ArrayObject.h"
|
||||
#include "vm/UnboxedObject.h"
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
#include "ds/TraceableFifo.h"
|
||||
#include "js/GCHashTable.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/TraceableVector.h"
|
||||
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
|
@ -203,7 +203,7 @@ BEGIN_TEST(testGCHandleHashMap)
|
|||
}
|
||||
END_TEST(testGCHandleHashMap)
|
||||
|
||||
using ShapeVec = TraceableVector<Shape*>;
|
||||
using ShapeVec = GCVector<Shape*>;
|
||||
|
||||
BEGIN_TEST(testGCRootedVector)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ BEGIN_TEST(testGCRootedVector)
|
|||
}
|
||||
|
||||
bool
|
||||
receiveConstRefToShapeVector(const JS::Rooted<TraceableVector<Shape*>>& rooted)
|
||||
receiveConstRefToShapeVector(const JS::Rooted<GCVector<Shape*>>& rooted)
|
||||
{
|
||||
// Ensure range enumeration works through the reference.
|
||||
for (auto shape : rooted) {
|
||||
|
@ -259,7 +259,7 @@ receiveConstRefToShapeVector(const JS::Rooted<TraceableVector<Shape*>>& rooted)
|
|||
}
|
||||
|
||||
bool
|
||||
receiveHandleToShapeVector(JS::Handle<TraceableVector<Shape*>> handle)
|
||||
receiveHandleToShapeVector(JS::Handle<GCVector<Shape*>> handle)
|
||||
{
|
||||
// Ensure range enumeration works through the handle.
|
||||
for (auto shape : handle) {
|
||||
|
@ -269,7 +269,7 @@ receiveHandleToShapeVector(JS::Handle<TraceableVector<Shape*>> handle)
|
|||
}
|
||||
|
||||
bool
|
||||
receiveMutableHandleToShapeVector(JS::MutableHandle<TraceableVector<Shape*>> handle)
|
||||
receiveMutableHandleToShapeVector(JS::MutableHandle<GCVector<Shape*>> handle)
|
||||
{
|
||||
// Ensure range enumeration works through the handle.
|
||||
for (auto shape : handle) {
|
||||
|
@ -318,7 +318,7 @@ BEGIN_TEST(testTraceableFifo)
|
|||
}
|
||||
END_TEST(testTraceableFifo)
|
||||
|
||||
using ShapeVec = TraceableVector<Shape*>;
|
||||
using ShapeVec = GCVector<Shape*>;
|
||||
|
||||
static bool
|
||||
FillVector(JSContext* cx, MutableHandle<ShapeVec> shapes)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "gc/GCInternals.h"
|
||||
#include "gc/Zone.h"
|
||||
#include "js/GCVector.h"
|
||||
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
|
@ -81,7 +82,7 @@ BEGIN_TEST(testGCUID)
|
|||
|
||||
// Allocate a few arenas worth of objects to ensure we get some compaction.
|
||||
const static size_t N = 2049;
|
||||
using ObjectVector = js::TraceableVector<JSObject*>;
|
||||
using ObjectVector = js::GCVector<JSObject*>;
|
||||
JS::Rooted<ObjectVector> vec(cx, ObjectVector(cx));
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
obj = JS_NewPlainObject(cx);
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
|
||||
#include "js/CallArgs.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/HashTable.h"
|
||||
#include "js/Id.h"
|
||||
#include "js/Principals.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/TracingAPI.h"
|
||||
#include "js/Utility.h"
|
||||
#include "js/Value.h"
|
||||
|
@ -218,9 +218,9 @@ typedef AutoVectorRooter<Value> AutoValueVector;
|
|||
typedef AutoVectorRooter<jsid> AutoIdVector;
|
||||
typedef AutoVectorRooter<JSObject*> AutoObjectVector;
|
||||
|
||||
using ValueVector = js::TraceableVector<JS::Value>;
|
||||
using IdVector = js::TraceableVector<jsid>;
|
||||
using ScriptVector = js::TraceableVector<JSScript*>;
|
||||
using ValueVector = js::GCVector<JS::Value>;
|
||||
using IdVector = js::GCVector<jsid>;
|
||||
using ScriptVector = js::GCVector<JSScript*>;
|
||||
|
||||
template<class Key, class Value>
|
||||
class MOZ_RAII AutoHashMapRooter : protected AutoGCRooter
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/Vector.h"
|
||||
#include "vm/Runtime.h"
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "gc/Marking.h"
|
||||
#include "js/Conversions.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/HeapAPI.h"
|
||||
#include "js/TraceableVector.h"
|
||||
#include "vm/Shape.h"
|
||||
#include "vm/String.h"
|
||||
#include "vm/Xdr.h"
|
||||
|
@ -34,7 +34,7 @@ struct ClassInfo;
|
|||
|
||||
namespace js {
|
||||
|
||||
using PropertyDescriptorVector = TraceableVector<PropertyDescriptor>;
|
||||
using PropertyDescriptorVector = GCVector<PropertyDescriptor>;
|
||||
class GCMarker;
|
||||
class Nursery;
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ EXPORTS.js += [
|
|||
'../public/Debug.h',
|
||||
'../public/GCAPI.h',
|
||||
'../public/GCHashTable.h',
|
||||
'../public/GCVector.h',
|
||||
'../public/HashTable.h',
|
||||
'../public/HeapAPI.h',
|
||||
'../public/Id.h',
|
||||
|
@ -125,7 +126,6 @@ EXPORTS.js += [
|
|||
'../public/RootingAPI.h',
|
||||
'../public/SliceBudget.h',
|
||||
'../public/StructuredClone.h',
|
||||
'../public/TraceableVector.h',
|
||||
'../public/TraceKind.h',
|
||||
'../public/TracingAPI.h',
|
||||
'../public/TrackedOptimizationInfo.h',
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
#include "gc/Tracer.h"
|
||||
#include "irregexp/RegExpStack.h"
|
||||
#include "js/Debug.h"
|
||||
#include "js/GCVector.h"
|
||||
#include "js/HashTable.h"
|
||||
#ifdef DEBUG
|
||||
# include "js/Proxy.h" // For AutoEnterPolicy
|
||||
#endif
|
||||
#include "js/TraceableVector.h"
|
||||
#include "js/Vector.h"
|
||||
#include "vm/CodeCoverage.h"
|
||||
#include "vm/CommonPropertyNames.h"
|
||||
|
@ -146,7 +146,7 @@ struct ScopeCoordinateNameCache {
|
|||
void purge();
|
||||
};
|
||||
|
||||
using ScriptAndCountsVector = TraceableVector<ScriptAndCounts, 0, SystemAllocPolicy>;
|
||||
using ScriptAndCountsVector = GCVector<ScriptAndCounts, 0, SystemAllocPolicy>;
|
||||
|
||||
struct EvalCacheEntry
|
||||
{
|
||||
|
|
|
@ -1136,7 +1136,7 @@ NameToId(PropertyName* name)
|
|||
return NON_INTEGER_ATOM_TO_JSID(name);
|
||||
}
|
||||
|
||||
using PropertyNameVector = js::TraceableVector<PropertyName*>;
|
||||
using PropertyNameVector = js::GCVector<PropertyName*>;
|
||||
|
||||
template <typename CharT>
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче