mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
39770f3213
- Bug 1274192 part 1 - make the MediaDecoderReaderWrapper as a proxy of WaitForData(); r=jwwang (9debdca9a9) - Bug 1274192 part 2 - make MDSM and SeekTask to adopt new MediaDecoderReaderWrapper API; r=jwwang (156f924dc9) - Bug 1276495: Don't reset audio promises for video only seek. r=jwwang,jya (c4632c7ff6) - Bug 1276318, part 1 - Fix leading tabs in ipc/glue. r=billm (46bcc4ccb3) - Bug 1035125 Part 6: Take Chromium commit 3181ba39ee787e1b40f4aea4be23f4f666ad0945 to add Windows 10 version to enumeration. r=aklotz (af62c8065f) - Bug 1270752 - Fix lifetime of buffer passed to PR_SetEnv(). r=jduell (bfce06ebea) - Bug 1275117 - Fix static strings leaks when mozlogging is on. r=jduell (8e9066c5d7) - Bug 1273048 - Add MOZ_GCC_VERSION_AT_MOST macro. r=froydnj (cfb5acdbe6) - Bug 1269968 - Remove unnecessary deduction on RefPtr.h. r=froydnj (30cf9bbf47) - Bug 525063 - add attribute to mark member variables that should be skipped by clang plugin initialization checker. r=nfroyd (78aa863f88) - Bug 1278391 - add move constructor to EnumeratedArray (r=njn) (5effe4e473) - Bug 1268518: Update basic-integer tests for rotations + clean up; r=sunfish (46827b6211) - Bug 1270370 - Part 1: Move SetIteratorObject to MapObject.h; r=jorendorff (01a27fbd50) - Bug 1270370 - Part 2: Expose MapIterator and SetIterator through ESClassValues; r=jorendorff (3edb3c7551) - Bug 1267551 (part 3) - Use MOZ_MUST_USE more in js/src/builtin/. r=jonco. (ea96d0fae0) - Bug 1267551 (part 4) - Use MOZ_MUST_USE more in js/src/asmjs/. r=bbouvier. (3e622c736d) - Bug 1268910: Refactor WebAssembly trap handling; r=luke (b59394a287) - Bug 1268910: Trap on edge cases for integer div/mod; r=sunfish (3d85230cc8) - Bug 1267551 (part 5) - Use MOZ_MUST_USE more in js/src/ctypes/. r=sfink. (e6580fb645) - Bug 1267551 (part 6) - Remove dead GenerateBlockId declaration. r=jorendorff. (74afcc549e) - Bug 1240072 - Add public JS APIs related to modules r=shu Bug 1267551 (part 7) - Use MOZ_MUST_USE more in js/src/frontend/. r=jorendorff. (5275c57768) - Bug 1267551 (part 8) - Use MOZ_MUST_USE more in js/src/gc/. r=terrence. (2572cc1c58) - Bug 1261063 - Part 1 - Remove public Telemetry functions that return raw histogram instances. r=chutten (3a68653c8f) - Bug 1261063 - Part 2 - Expose C++ function to clear Telemetry histograms. r=chutten (1f42f6aa1e) - Bug 1261063 - Part 3 - Make RasterImage use the public Telemetry API. r=tnikkel (0f564f3836) - Bug 1261063 - Part 4 - Use a count histogram for WebRTC call counts. r=jesup (b6b7b649e0) - Bug 1270073 - Point to Telemetry documentation in Telemetry.h. r=chutten (517279b284) - Bug 1261052 - Move C++ histogram implementation code into a separate module. r=gfritzsche. (66bcb1e167) - Bug 1145164 - Allow non-unitary increments to count histograms. r=gfritzsche (507e076e28) - Bug 1173447 - Add test for incremental pre-barriers when storing things under roots, r=jonco (caf8bd16be) - Bug 1267551 (part 10) - Use MOZ_MUST_USE in AutoVectorRooterBase. r=terrence. (2c5ed87a9f) - This catches a missing check. (b2fcd30fc5) - Bug 1267551 (part 11b) - Follow-up to fix Android bustage. r=me (f464ca7b98) - Bug 1271854 - Part 1: Allow specifying multiple GC zeal levels; r=terrence (da3c3e1281) - Bug 1271854 - Part 2: Allow specifying zeal modes by name as well; r=terrence (f63926e45b) - Bug 1271854 - Part 3: Avoid saving the GC zeal string inside the JS shell; r=terrence (f09b262e55) - Bug 1270062 - Unbust Windows full duplex. a=Tomcat (3c8b5887b6) - Bug 1270062 - Update libcubeb. rs=jesup (71805cb0e0) - Bug 1270004 - Update libcubeb. rs=jesup (2d90b9662f) - Bug 1280280 - Update cubeb to 073c9f011114. r=kinetik (6bee6a7f21) - Bug 1280280 - Update media/libcube/update.sh to add cubeb_jack.cpp, and sort the list of files. r=kinetik (430b7533c4) - Bug 1272604 - Add a zeal mode to check the heap after a moving GC r=terrence (85c018d71f) - Bug 1272604 - Fix bad implicit conversion constructor build error r=me (5c4e1dbc44) - Bug 1272604 - Fix hazard analysis failure r=me (0591aa2dca) - Bug 1232417 - Use a Variant to represent the CrossCompartmentWrapperMap key; r=jonco (512da0bab3) - Bug 1269928 - Fold DirectProxyHandler into Wrapper, which is now its only (non-test) consumer. r=efaust (7c6bb6e898) - Bug 1273639 - Add a nonunified spidermonkey build, r=terrence (d6fa13545c) - Bug 1273639 - Fix nonunified spidermonkey builds, r=terrence (3e0544510d) - Bug 1273180 - Trigger major GC if necessary after minor GC r=terrence (a9a9be8b17) - Bug 1268992 - Assert that the heap is empty after a shutdown GC; r=jonco (fe3ac5bdd6) - Bug 1273908 - Refactor GC to make it easier to add new kinds of GC thing r=terrence (51c92e1b05)
209 lines
7.5 KiB
C++
209 lines
7.5 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* 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_TraceKind_h
|
|
#define js_TraceKind_h
|
|
|
|
#include "mozilla/UniquePtr.h"
|
|
|
|
#include "js/TypeDecls.h"
|
|
|
|
// Forward declarations of all the types a TraceKind can denote.
|
|
namespace js {
|
|
class BaseShape;
|
|
class LazyScript;
|
|
class ObjectGroup;
|
|
class Shape;
|
|
namespace jit {
|
|
class JitCode;
|
|
} // namespace jit
|
|
} // namespace js
|
|
|
|
namespace JS {
|
|
|
|
// When tracing a thing, the GC needs to know about the layout of the object it
|
|
// is looking at. There are a fixed number of different layouts that the GC
|
|
// knows about. The "trace kind" is a static map which tells which layout a GC
|
|
// thing has.
|
|
//
|
|
// Although this map is public, the details are completely hidden. Not all of
|
|
// the matching C++ types are exposed, and those that are, are opaque.
|
|
//
|
|
// See Value::gcKind() and JSTraceCallback in Tracer.h for more details.
|
|
enum class TraceKind
|
|
{
|
|
// These trace kinds have a publicly exposed, although opaque, C++ type.
|
|
// Note: The order here is determined by our Value packing. Other users
|
|
// should sort alphabetically, for consistency.
|
|
Object = 0x00,
|
|
String = 0x01,
|
|
Symbol = 0x02,
|
|
Script = 0x03,
|
|
|
|
// Shape details are exposed through JS_TraceShapeCycleCollectorChildren.
|
|
Shape = 0x04,
|
|
|
|
// ObjectGroup details are exposed through JS_TraceObjectGroupCycleCollectorChildren.
|
|
ObjectGroup = 0x05,
|
|
|
|
// The kind associated with a nullptr.
|
|
Null = 0x06,
|
|
|
|
// The following kinds do not have an exposed C++ idiom.
|
|
BaseShape = 0x0F,
|
|
JitCode = 0x1F,
|
|
LazyScript = 0x2F
|
|
};
|
|
const static uintptr_t OutOfLineTraceKindMask = 0x07;
|
|
static_assert(uintptr_t(JS::TraceKind::BaseShape) & OutOfLineTraceKindMask, "mask bits are set");
|
|
static_assert(uintptr_t(JS::TraceKind::JitCode) & OutOfLineTraceKindMask, "mask bits are set");
|
|
static_assert(uintptr_t(JS::TraceKind::LazyScript) & OutOfLineTraceKindMask, "mask bits are set");
|
|
|
|
// When this header is imported inside SpiderMonkey, the class definitions are
|
|
// available and we can query those definitions to find the correct kind
|
|
// directly from the class hierarchy.
|
|
template <typename T>
|
|
struct MapTypeToTraceKind {
|
|
static const JS::TraceKind kind = T::TraceKind;
|
|
};
|
|
|
|
// When this header is used outside SpiderMonkey, the class definitions are not
|
|
// available, so the following table containing all public GC types is used.
|
|
#define JS_FOR_EACH_TRACEKIND(D) \
|
|
/* PrettyName TypeName AddToCCKind */ \
|
|
D(BaseShape, js::BaseShape, true) \
|
|
D(JitCode, js::jit::JitCode, true) \
|
|
D(LazyScript, js::LazyScript, true) \
|
|
D(Object, JSObject, true) \
|
|
D(ObjectGroup, js::ObjectGroup, true) \
|
|
D(Script, JSScript, true) \
|
|
D(Shape, js::Shape, true) \
|
|
D(String, JSString, false) \
|
|
D(Symbol, JS::Symbol, false)
|
|
|
|
// Map from all public types to their trace kind.
|
|
#define JS_EXPAND_DEF(name, type, _) \
|
|
template <> struct MapTypeToTraceKind<type> { \
|
|
static const JS::TraceKind kind = JS::TraceKind::name; \
|
|
};
|
|
JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
|
|
#undef JS_EXPAND_DEF
|
|
|
|
// RootKind is closely related to TraceKind. Whereas TraceKind's indices are
|
|
// laid out for convenient embedding as a pointer tag, the indicies of RootKind
|
|
// are designed for use as array keys via EnumeratedArray.
|
|
enum class RootKind : int8_t
|
|
{
|
|
// These map 1:1 with trace kinds.
|
|
#define EXPAND_ROOT_KIND(name, _0, _1) \
|
|
name,
|
|
JS_FOR_EACH_TRACEKIND(EXPAND_ROOT_KIND)
|
|
#undef EXPAND_ROOT_KIND
|
|
|
|
// These tagged pointers are special-cased for performance.
|
|
Id,
|
|
Value,
|
|
|
|
// Everything else.
|
|
Traceable,
|
|
|
|
Limit
|
|
};
|
|
|
|
// Most RootKind correspond directly to a trace kind.
|
|
template <TraceKind traceKind> struct MapTraceKindToRootKind {};
|
|
#define JS_EXPAND_DEF(name, _0, _1) \
|
|
template <> struct MapTraceKindToRootKind<JS::TraceKind::name> { \
|
|
static const JS::RootKind kind = JS::RootKind::name; \
|
|
};
|
|
JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF)
|
|
#undef JS_EXPAND_DEF
|
|
|
|
// Specify the RootKind for all types. Value and jsid map to special cases;
|
|
// pointer types we can derive directly from the TraceKind; everything else
|
|
// should go in the Traceable list and use GCPolicy<T>::trace for tracing.
|
|
template <typename T>
|
|
struct MapTypeToRootKind {
|
|
static const JS::RootKind kind = JS::RootKind::Traceable;
|
|
};
|
|
template <typename T>
|
|
struct MapTypeToRootKind<T*> {
|
|
static const JS::RootKind kind =
|
|
JS::MapTraceKindToRootKind<JS::MapTypeToTraceKind<T>::kind>::kind;
|
|
};
|
|
template <typename T>
|
|
struct MapTypeToRootKind<mozilla::UniquePtr<T>> {
|
|
static const JS::RootKind kind = JS::MapTypeToRootKind<T>::kind;
|
|
};
|
|
template <> struct MapTypeToRootKind<JS::Value> {
|
|
static const JS::RootKind kind = JS::RootKind::Value;
|
|
};
|
|
template <> struct MapTypeToRootKind<jsid> {
|
|
static const JS::RootKind kind = JS::RootKind::Id;
|
|
};
|
|
template <> struct MapTypeToRootKind<JSFunction*> : public MapTypeToRootKind<JSObject*> {};
|
|
|
|
// Fortunately, few places in the system need to deal with fully abstract
|
|
// cells. In those places that do, we generally want to move to a layout
|
|
// templated function as soon as possible. This template wraps the upcast
|
|
// for that dispatch.
|
|
//
|
|
// Given a call:
|
|
//
|
|
// DispatchTraceKindTyped(f, thing, traceKind, ... args)
|
|
//
|
|
// Downcast the |void *thing| to the specific type designated by |traceKind|,
|
|
// and pass it to the functor |f| along with |... args|, forwarded. Pass the
|
|
// type designated by |traceKind| as the functor's template argument. The
|
|
// |thing| parameter is optional; without it, we simply pass through |... args|.
|
|
|
|
// GCC and Clang require an explicit template declaration in front of the
|
|
// specialization of operator() because it is a dependent template. MSVC, on
|
|
// the other hand, gets very confused if we have a |template| token there.
|
|
// The clang-cl front end defines _MSC_VER, but still requires the explicit
|
|
// template declaration, so we must test for __clang__ here as well.
|
|
#if defined(_MSC_VER) && !defined(__clang__)
|
|
# define JS_DEPENDENT_TEMPLATE_HINT
|
|
#else
|
|
# define JS_DEPENDENT_TEMPLATE_HINT template
|
|
#endif
|
|
template <typename F, typename... Args>
|
|
auto
|
|
DispatchTraceKindTyped(F f, JS::TraceKind traceKind, Args&&... args)
|
|
-> decltype(f. JS_DEPENDENT_TEMPLATE_HINT operator()<JSObject>(mozilla::Forward<Args>(args)...))
|
|
{
|
|
switch (traceKind) {
|
|
#define JS_EXPAND_DEF(name, type, _) \
|
|
case JS::TraceKind::name: \
|
|
return f. JS_DEPENDENT_TEMPLATE_HINT operator()<type>(mozilla::Forward<Args>(args)...);
|
|
JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
|
|
#undef JS_EXPAND_DEF
|
|
default:
|
|
MOZ_CRASH("Invalid trace kind in DispatchTraceKindTyped.");
|
|
}
|
|
}
|
|
#undef JS_DEPENDENT_TEMPLATE_HINT
|
|
|
|
template <typename F, typename... Args>
|
|
auto
|
|
DispatchTraceKindTyped(F f, void* thing, JS::TraceKind traceKind, Args&&... args)
|
|
-> decltype(f(static_cast<JSObject*>(nullptr), mozilla::Forward<Args>(args)...))
|
|
{
|
|
switch (traceKind) {
|
|
#define JS_EXPAND_DEF(name, type, _) \
|
|
case JS::TraceKind::name: \
|
|
return f(static_cast<type*>(thing), mozilla::Forward<Args>(args)...);
|
|
JS_FOR_EACH_TRACEKIND(JS_EXPAND_DEF);
|
|
#undef JS_EXPAND_DEF
|
|
default:
|
|
MOZ_CRASH("Invalid trace kind in DispatchTraceKindTyped.");
|
|
}
|
|
}
|
|
|
|
} // namespace JS
|
|
|
|
#endif // js_TraceKind_h
|