зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1603256 - Convert |JS::UnsafeTraceRoot| from a template to separate function overloads. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D56807 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4a33f58e01
Коммит
e544e8f369
|
@ -432,14 +432,26 @@ inline void TraceEdge(JSTracer* trc, JS::TenuredHeap<T>* thingp,
|
|||
}
|
||||
|
||||
// Edges that are always traced as part of root marking do not require
|
||||
// incremental barriers. This function allows for marking non-barriered
|
||||
// pointers, but asserts that this happens during root marking.
|
||||
// incremental barriers. |JS::UnsafeTraceRoot| overloads allow for marking
|
||||
// non-barriered pointers but assert that this happens during root marking.
|
||||
//
|
||||
// Note that while |edgep| must never be null, it is fine for |*edgep| to be
|
||||
// nullptr.
|
||||
template <typename T>
|
||||
extern JS_PUBLIC_API void UnsafeTraceRoot(JSTracer* trc, T* edgep,
|
||||
const char* name);
|
||||
#define JS_DECLARE_UNSAFE_TRACE_ROOT(type) \
|
||||
extern JS_PUBLIC_API void UnsafeTraceRoot(JSTracer* trc, type* edgep, \
|
||||
const char* name);
|
||||
|
||||
// Declare edge-tracing function overloads for public GC pointer types.
|
||||
JS_FOR_EACH_PUBLIC_GC_POINTER_TYPE(JS_DECLARE_UNSAFE_TRACE_ROOT)
|
||||
JS_FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(JS_DECLARE_UNSAFE_TRACE_ROOT)
|
||||
|
||||
// We also require overloads for these purely-internal types. These overloads
|
||||
// ought not be in public headers, and they should use a different name in order
|
||||
// to not be *actual* overloads, but for the moment we still declare them here.
|
||||
JS_DECLARE_UNSAFE_TRACE_ROOT(js::AbstractGeneratorObject*)
|
||||
JS_DECLARE_UNSAFE_TRACE_ROOT(js::SavedFrame*)
|
||||
|
||||
#undef JS_DECLARE_UNSAFE_TRACE_ROOT
|
||||
|
||||
extern JS_PUBLIC_API void TraceChildren(JSTracer* trc, GCCellPtr thing);
|
||||
|
||||
|
|
|
@ -442,8 +442,7 @@ JS_PUBLIC_API void js::UnsafeTraceManuallyBarrieredEdge(JSTracer* trc,
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
JS_PUBLIC_API void JS::UnsafeTraceRoot(JSTracer* trc, T* thingp,
|
||||
const char* name) {
|
||||
static void UnsafeTraceRootHelper(JSTracer* trc, T* thingp, const char* name) {
|
||||
MOZ_ASSERT(thingp);
|
||||
js::TraceNullableRoot(trc, thingp, name);
|
||||
}
|
||||
|
@ -469,21 +468,21 @@ DEFINE_TRACE_EXTERNAL_EDGE_FUNCTION(SavedFrame*)
|
|||
|
||||
#undef DEFINE_TRACE_EXTERNAL_EDGE_FUNCTION
|
||||
|
||||
#define INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION(type) \
|
||||
template JS_PUBLIC_API void JS::UnsafeTraceRoot<type>(JSTracer*, type*, \
|
||||
const char*);
|
||||
#define DEFINE_UNSAFE_TRACE_ROOT_FUNCTION(type) \
|
||||
JS_PUBLIC_API void JS::UnsafeTraceRoot(JSTracer* trc, type* thingp, \
|
||||
const char* name) { \
|
||||
UnsafeTraceRootHelper(trc, thingp, name); \
|
||||
}
|
||||
|
||||
// Instantiate UnsafeTraceRoot for each public GC pointer type.
|
||||
JS_FOR_EACH_PUBLIC_GC_POINTER_TYPE(INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION)
|
||||
JS_FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(
|
||||
INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION)
|
||||
// Define UnsafeTraceRoot for each public GC pointer type.
|
||||
JS_FOR_EACH_PUBLIC_GC_POINTER_TYPE(DEFINE_UNSAFE_TRACE_ROOT_FUNCTION)
|
||||
JS_FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(DEFINE_UNSAFE_TRACE_ROOT_FUNCTION)
|
||||
|
||||
// Also, for the moment, instantiate UnsafeTraceRoot for internal GC pointer
|
||||
// types.
|
||||
INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION(AbstractGeneratorObject*)
|
||||
INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION(SavedFrame*)
|
||||
// Also, for the moment, define UnsafeTraceRoot for internal GC pointer types.
|
||||
DEFINE_UNSAFE_TRACE_ROOT_FUNCTION(AbstractGeneratorObject*)
|
||||
DEFINE_UNSAFE_TRACE_ROOT_FUNCTION(SavedFrame*)
|
||||
|
||||
#undef INSTANTIATE_UNSAFE_TRACE_ROOT_FUNCTION
|
||||
#undef DEFINE_UNSAFE_TRACE_ROOT_FUNCTION
|
||||
|
||||
namespace js {
|
||||
namespace gc {
|
||||
|
|
Загрузка…
Ссылка в новой задаче