mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1063247: Amend JS::ubi::Node::size and its implementations to expect a mozilla::MallocSizeOf function. r=terrence
Note that JS::ubi::Node::size has no callers at present, so we can change its type without changing any callers.
This commit is contained in:
parent
11c263f4f6
commit
24bff230a9
@ -10,6 +10,7 @@
|
||||
#include "mozilla/Alignment.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Move.h"
|
||||
|
||||
#include "jspubtd.h"
|
||||
@ -178,7 +179,9 @@ class Base {
|
||||
|
||||
// Return the size of this node, in bytes. Include any structures that this
|
||||
// node owns exclusively that are not exposed as their own ubi::Nodes.
|
||||
virtual size_t size() const { return 0; }
|
||||
// |mallocSizeOf| should be a malloc block sizing function; see
|
||||
// |mfbt/MemoryReporting.h.
|
||||
virtual size_t size(mozilla::MallocSizeOf mallocSizeof) const { return 0; }
|
||||
|
||||
// Return an EdgeRange that initially contains all the referent's outgoing
|
||||
// edges. The EdgeRange should be freed with 'js_delete'. (You could use
|
||||
@ -321,9 +324,13 @@ class Node {
|
||||
JS::Value exposeToJS() const;
|
||||
|
||||
const char16_t *typeName() const { return base()->typeName(); }
|
||||
size_t size() const { return base()->size(); }
|
||||
JS::Zone *zone() const { return base()->zone(); }
|
||||
JSCompartment *compartment() const { return base()->compartment(); }
|
||||
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeof) const {
|
||||
return base()->size(mallocSizeof);
|
||||
}
|
||||
|
||||
EdgeRange *edges(JSContext *cx, bool wantNames = true) const {
|
||||
return base()->edges(cx, wantNames);
|
||||
}
|
||||
@ -455,7 +462,7 @@ template<> struct Concrete<JSScript> : TracerConcreteWithCompartment<JSScript> {
|
||||
template<>
|
||||
class Concrete<void> : public Base {
|
||||
const char16_t *typeName() const MOZ_OVERRIDE;
|
||||
size_t size() const MOZ_OVERRIDE;
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeOf) const MOZ_OVERRIDE;
|
||||
EdgeRange *edges(JSContext *cx, bool wantNames) const MOZ_OVERRIDE;
|
||||
JS::Zone *zone() const MOZ_OVERRIDE;
|
||||
JSCompartment *compartment() const MOZ_OVERRIDE;
|
||||
|
@ -37,11 +37,16 @@ using JS::ubi::TracerConcreteWithCompartment;
|
||||
|
||||
// All operations on null ubi::Nodes crash.
|
||||
const char16_t *Concrete<void>::typeName() const { MOZ_CRASH("null ubi::Node"); }
|
||||
size_t Concrete<void>::size() const { MOZ_CRASH("null ubi::Node"); }
|
||||
EdgeRange *Concrete<void>::edges(JSContext *, bool) const { MOZ_CRASH("null ubi::Node"); }
|
||||
JS::Zone *Concrete<void>::zone() const { MOZ_CRASH("null ubi::Node"); }
|
||||
JSCompartment *Concrete<void>::compartment() const { MOZ_CRASH("null ubi::Node"); }
|
||||
|
||||
size_t
|
||||
Concrete<void>::size(mozilla::MallocSizeOf mallocSizeof) const
|
||||
{
|
||||
MOZ_CRASH("null ubi::Node");
|
||||
}
|
||||
|
||||
Node::Node(JSGCTraceKind kind, void *ptr)
|
||||
{
|
||||
switch (kind) {
|
||||
|
Loading…
Reference in New Issue
Block a user