mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1198980 - Make JS::ubi::*::identifier be uint64_t instead of uintptr_t. r=sfink
This commit is contained in:
parent
2f0ae407dc
commit
ca554a96b3
@ -201,7 +201,7 @@ class BaseStackFrame {
|
||||
|
||||
// Get a unique identifier for this StackFrame. The identifier is not valid
|
||||
// across garbage collections.
|
||||
virtual uintptr_t identifier() const { return reinterpret_cast<uintptr_t>(ptr); }
|
||||
virtual uint64_t identifier() const { return reinterpret_cast<uint64_t>(ptr); }
|
||||
|
||||
// Get this frame's parent frame.
|
||||
virtual StackFrame parent() const = 0;
|
||||
@ -376,7 +376,7 @@ class StackFrame : public JS::Traceable {
|
||||
// Methods that forward to virtual calls through BaseStackFrame.
|
||||
|
||||
void trace(JSTracer* trc) { base()->trace(trc); }
|
||||
uintptr_t identifier() const { return base()->identifier(); }
|
||||
uint64_t identifier() const { return base()->identifier(); }
|
||||
uint32_t line() const { return base()->line(); }
|
||||
uint32_t column() const { return base()->column(); }
|
||||
AtomOrTwoByteChars source() const { return base()->source(); }
|
||||
@ -415,7 +415,7 @@ class ConcreteStackFrame<void> : public BaseStackFrame {
|
||||
public:
|
||||
static void construct(void* storage, void*) { new (storage) ConcreteStackFrame(nullptr); }
|
||||
|
||||
uintptr_t identifier() const override { return 0; }
|
||||
uint64_t identifier() const override { return 0; }
|
||||
void trace(JSTracer* trc) override { }
|
||||
bool constructSavedFrameStack(JSContext* cx, MutableHandleObject out) const override {
|
||||
out.set(nullptr);
|
||||
@ -470,14 +470,14 @@ class Base {
|
||||
//
|
||||
// This is probably suitable for use in serializations, as it is an integral
|
||||
// type. It may also help save memory when constructing HashSets of
|
||||
// ubi::Nodes: since a uintptr_t will always be smaller than a ubi::Node, a
|
||||
// HashSet<ubi::Node::Id> will use less space per element than a
|
||||
// HashSet<ubi::Node>.
|
||||
// ubi::Nodes: since a uint64_t will always be smaller-or-equal-to the size
|
||||
// of a ubi::Node, a HashSet<ubi::Node::Id> may use less space per element
|
||||
// than a HashSet<ubi::Node>.
|
||||
//
|
||||
// (Note that 'unique' only means 'up to equality on ubi::Node'; see the
|
||||
// caveats about multiple objects allocated at the same address for
|
||||
// 'ubi::Node::operator=='.)
|
||||
typedef uintptr_t Id;
|
||||
using Id = uint64_t;
|
||||
virtual Id identifier() const { return reinterpret_cast<Id>(ptr); }
|
||||
|
||||
// Returns true if this node is pointing to something on the live heap, as
|
||||
@ -496,7 +496,8 @@ class Base {
|
||||
// node owns exclusively that are not exposed as their own ubi::Nodes.
|
||||
// |mallocSizeOf| should be a malloc block sizing function; see
|
||||
// |mfbt/MemoryReporting.h|.
|
||||
virtual size_t size(mozilla::MallocSizeOf mallocSizeof) const { return 1; }
|
||||
using Size = uint64_t;
|
||||
virtual Size size(mozilla::MallocSizeOf mallocSizeof) const { return 1; }
|
||||
|
||||
// Return an EdgeRange that initially contains all the referent's outgoing
|
||||
// edges. The caller takes ownership of the EdgeRange.
|
||||
@ -688,7 +689,8 @@ class Node {
|
||||
return base()->jsObjectConstructorName(cx, outName);
|
||||
}
|
||||
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeof) const {
|
||||
using Size = Base::Size;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeof) const {
|
||||
return base()->size(mallocSizeof);
|
||||
}
|
||||
|
||||
@ -701,7 +703,7 @@ class Node {
|
||||
return base()->allocationStack();
|
||||
}
|
||||
|
||||
typedef Base::Id Id;
|
||||
using Id = Base::Id;
|
||||
Id identifier() const { return base()->identifier(); }
|
||||
|
||||
// A hash policy for ubi::Nodes.
|
||||
@ -969,7 +971,7 @@ class Concrete<JSObject> : public TracerConcreteWithCompartment<JSObject> {
|
||||
const char* jsObjectClassName() const override;
|
||||
bool jsObjectConstructorName(JSContext* cx,
|
||||
UniquePtr<char16_t[], JS::FreePolicy>& outName) const override;
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
||||
bool hasAllocationStack() const override;
|
||||
StackFrame allocationStack() const override;
|
||||
@ -985,7 +987,7 @@ class Concrete<JSObject> : public TracerConcreteWithCompartment<JSObject> {
|
||||
|
||||
// For JSString, we extend the generic template with a 'size' implementation.
|
||||
template<> struct Concrete<JSString> : TracerConcrete<JSString> {
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
||||
protected:
|
||||
explicit Concrete(JSString *ptr) : TracerConcrete<JSString>(ptr) { }
|
||||
@ -998,7 +1000,7 @@ template<> struct Concrete<JSString> : TracerConcrete<JSString> {
|
||||
template<>
|
||||
class Concrete<void> : public Base {
|
||||
const char16_t* typeName() const override;
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
Size size(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
UniquePtr<EdgeRange> edges(JSContext* cx, bool wantNames) const override;
|
||||
JS::Zone* zone() const override;
|
||||
JSCompartment* compartment() const override;
|
||||
|
@ -3625,7 +3625,7 @@ JSObject::sizeOfIncludingThisInNursery() const
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t
|
||||
JS::ubi::Node::Size
|
||||
JS::ubi::Concrete<JSObject>::size(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
JSObject& obj = get();
|
||||
|
@ -67,7 +67,7 @@ JSString::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf)
|
||||
: mallocSizeOf(flat.rawTwoByteChars());
|
||||
}
|
||||
|
||||
size_t
|
||||
JS::ubi::Node::Size
|
||||
JS::ubi::Concrete<JSString>::size(mozilla::MallocSizeOf mallocSizeOf) const
|
||||
{
|
||||
JSString &str = get();
|
||||
|
@ -281,7 +281,7 @@ Concrete<void>::edges(JSContext*, bool) const {
|
||||
MOZ_CRASH("null ubi::Node");
|
||||
}
|
||||
|
||||
size_t
|
||||
Node::Size
|
||||
Concrete<void>::size(mozilla::MallocSizeOf mallocSizeof) const
|
||||
{
|
||||
MOZ_CRASH("null ubi::Node");
|
||||
|
@ -118,7 +118,7 @@ Concrete<DeserializedNode>::typeName() const
|
||||
return get().typeName;
|
||||
}
|
||||
|
||||
size_t
|
||||
Node::Size
|
||||
Concrete<DeserializedNode>::size(mozilla::MallocSizeOf mallocSizeof) const
|
||||
{
|
||||
return get().size;
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
Id identifier() const override { return get().id; }
|
||||
bool isLive() const override { return false; }
|
||||
const char16_t* typeName() const override;
|
||||
size_t size(mozilla::MallocSizeOf mallocSizeof) const override;
|
||||
Node::Size size(mozilla::MallocSizeOf mallocSizeof) const override;
|
||||
const char* jsObjectClassName() const override { return get().jsObjectClassName.get(); }
|
||||
|
||||
bool hasAllocationStack() const override { return get().allocationStack.isSome(); }
|
||||
@ -256,7 +256,7 @@ public:
|
||||
new (storage) ConcreteStackFrame(ptr);
|
||||
}
|
||||
|
||||
uintptr_t identifier() const override { return get().id; }
|
||||
uint64_t identifier() const override { return get().id; }
|
||||
uint32_t line() const override { return get().line; }
|
||||
uint32_t column() const override { return get().column; }
|
||||
bool isSystem() const override { return get().isSystem; }
|
||||
|
@ -40,8 +40,8 @@ DEF_TEST(DeserializedNodeUbiNodes, {
|
||||
const char16_t* typeName = MOZ_UTF16("TestTypeName");
|
||||
const char* className = "MyObjectClassName";
|
||||
|
||||
NodeId id = 1L << 33;
|
||||
uint64_t size = 1L << 60;
|
||||
NodeId id = uint64_t(1) << 33;
|
||||
uint64_t size = uint64_t(1) << 60;
|
||||
MockDeserializedNode mocked(id, typeName, size);
|
||||
mocked.jsObjectClassName = mozilla::UniquePtr<char[]>(strdup(className));
|
||||
ASSERT_TRUE(!!mocked.jsObjectClassName);
|
||||
|
@ -21,7 +21,7 @@ struct MockDeserializedStackFrame : public DeserializedStackFrame
|
||||
};
|
||||
|
||||
DEF_TEST(DeserializedStackFrameUbiStackFrames, {
|
||||
StackFrameId id = 1L << 42;
|
||||
StackFrameId id = uint64_t(1) << 42;
|
||||
uint32_t line = 1337;
|
||||
uint32_t column = 9; // 3 space tabs!?
|
||||
const char16_t* source = MOZ_UTF16("my-javascript-file.js");
|
||||
|
@ -186,7 +186,7 @@ class Concrete<FakeNode> : public Base
|
||||
return UniquePtr<EdgeRange>(js_new<PreComputedEdgeRange>(cx, get().edges));
|
||||
}
|
||||
|
||||
size_t size(mozilla::MallocSizeOf) const override {
|
||||
Size size(mozilla::MallocSizeOf) const override {
|
||||
return get().size;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user