Bug 793314 - Remove PtrBits; r=mounir,roc
This commit is contained in:
@@ -897,7 +897,7 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
bool HasFlag(PtrBits aFlag) const
|
||||
bool HasFlag(uintptr_t aFlag) const
|
||||
{
|
||||
return !!(GetFlags() & aFlag);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsDOMString.h"
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
|
||||
#define NS_ATTRNAME_NODEINFO_BIT 1
|
||||
class nsAttrName
|
||||
{
|
||||
@@ -29,7 +27,7 @@ public:
|
||||
}
|
||||
|
||||
explicit nsAttrName(nsIAtom* aAtom)
|
||||
: mBits(reinterpret_cast<PtrBits>(aAtom))
|
||||
: mBits(reinterpret_cast<uintptr_t>(aAtom))
|
||||
{
|
||||
NS_ASSERTION(aAtom, "null atom-name in nsAttrName");
|
||||
NS_ADDREF(aAtom);
|
||||
@@ -39,11 +37,11 @@ public:
|
||||
{
|
||||
NS_ASSERTION(aNodeInfo, "null nodeinfo-name in nsAttrName");
|
||||
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
mBits = reinterpret_cast<PtrBits>(aNodeInfo->NameAtom());
|
||||
mBits = reinterpret_cast<uintptr_t>(aNodeInfo->NameAtom());
|
||||
NS_ADDREF(aNodeInfo->NameAtom());
|
||||
}
|
||||
else {
|
||||
mBits = reinterpret_cast<PtrBits>(aNodeInfo) |
|
||||
mBits = reinterpret_cast<uintptr_t>(aNodeInfo) |
|
||||
NS_ATTRNAME_NODEINFO_BIT;
|
||||
NS_ADDREF(aNodeInfo);
|
||||
}
|
||||
@@ -60,11 +58,11 @@ public:
|
||||
|
||||
ReleaseInternalName();
|
||||
if (aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
mBits = reinterpret_cast<PtrBits>(aNodeInfo->NameAtom());
|
||||
mBits = reinterpret_cast<uintptr_t>(aNodeInfo->NameAtom());
|
||||
NS_ADDREF(aNodeInfo->NameAtom());
|
||||
}
|
||||
else {
|
||||
mBits = reinterpret_cast<PtrBits>(aNodeInfo) |
|
||||
mBits = reinterpret_cast<uintptr_t>(aNodeInfo) |
|
||||
NS_ATTRNAME_NODEINFO_BIT;
|
||||
NS_ADDREF(aNodeInfo);
|
||||
}
|
||||
@@ -75,7 +73,7 @@ public:
|
||||
NS_ASSERTION(aAtom, "null atom-name in nsAttrName");
|
||||
|
||||
ReleaseInternalName();
|
||||
mBits = reinterpret_cast<PtrBits>(aAtom);
|
||||
mBits = reinterpret_cast<uintptr_t>(aAtom);
|
||||
NS_ADDREF(aAtom);
|
||||
}
|
||||
|
||||
@@ -104,7 +102,7 @@ public:
|
||||
// Faster comparison in the case we know the namespace is null
|
||||
bool Equals(nsIAtom* aAtom) const
|
||||
{
|
||||
return reinterpret_cast<PtrBits>(aAtom) == mBits;
|
||||
return reinterpret_cast<uintptr_t>(aAtom) == mBits;
|
||||
}
|
||||
|
||||
bool Equals(nsIAtom* aLocalName, int32_t aNamespaceID) const
|
||||
@@ -180,7 +178,7 @@ public:
|
||||
|
||||
bool IsSmaller(nsIAtom* aOther) const
|
||||
{
|
||||
return mBits < reinterpret_cast<PtrBits>(aOther);
|
||||
return mBits < reinterpret_cast<uintptr_t>(aOther);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -205,7 +203,7 @@ private:
|
||||
NS_RELEASE(name);
|
||||
}
|
||||
|
||||
PtrBits mBits;
|
||||
uintptr_t mBits;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -564,7 +564,7 @@ nsAttrValue::SetTo(const nsSVGViewBox& aValue, const nsAString* aSerialized)
|
||||
void
|
||||
nsAttrValue::SwapValueWith(nsAttrValue& aOther)
|
||||
{
|
||||
PtrBits tmp = aOther.mBits;
|
||||
uintptr_t tmp = aOther.mBits;
|
||||
aOther.mBits = mBits;
|
||||
mBits = tmp;
|
||||
}
|
||||
@@ -1536,7 +1536,7 @@ nsAttrValue::SetColorValue(nscolor aColor, const nsAString& aString)
|
||||
cont->mType = eColor;
|
||||
|
||||
// Save the literal string we were passed for round-tripping.
|
||||
cont->mStringBits = reinterpret_cast<PtrBits>(buf) | eStringBase;
|
||||
cont->mStringBits = reinterpret_cast<uintptr_t>(buf) | eStringBase;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1713,12 +1713,12 @@ nsAttrValue::SetMiscAtomOrString(const nsAString* aValue)
|
||||
if (len <= NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM) {
|
||||
nsIAtom* atom = NS_NewAtom(*aValue);
|
||||
if (atom) {
|
||||
cont->mStringBits = reinterpret_cast<PtrBits>(atom) | eAtomBase;
|
||||
cont->mStringBits = reinterpret_cast<uintptr_t>(atom) | eAtomBase;
|
||||
}
|
||||
} else {
|
||||
nsStringBuffer* buf = GetStringBuffer(*aValue);
|
||||
if (buf) {
|
||||
cont->mStringBits = reinterpret_cast<PtrBits>(buf) | eStringBase;
|
||||
cont->mStringBits = reinterpret_cast<uintptr_t>(buf) | eStringBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "SVGAttrValueWrapper.h"
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
class nsAString;
|
||||
class nsIAtom;
|
||||
class nsIDocument;
|
||||
@@ -39,11 +38,11 @@ struct ImageValue;
|
||||
|
||||
#define NS_ATTRVALUE_MAX_STRINGLENGTH_ATOM 12
|
||||
|
||||
#define NS_ATTRVALUE_BASETYPE_MASK (PtrBits(3))
|
||||
#define NS_ATTRVALUE_BASETYPE_MASK (uintptr_t(3))
|
||||
#define NS_ATTRVALUE_POINTERVALUE_MASK (~NS_ATTRVALUE_BASETYPE_MASK)
|
||||
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_BITS 4
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MASK (PtrBits((1 << NS_ATTRVALUE_INTEGERTYPE_BITS) - 1))
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MASK (uintptr_t((1 << NS_ATTRVALUE_INTEGERTYPE_BITS) - 1))
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER (1 << NS_ATTRVALUE_INTEGERTYPE_BITS)
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MAXVALUE ((1 << (31 - NS_ATTRVALUE_INTEGERTYPE_BITS)) - 1)
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MINVALUE (-NS_ATTRVALUE_INTEGERTYPE_MAXVALUE - 1)
|
||||
@@ -52,7 +51,7 @@ struct ImageValue;
|
||||
#define NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER (1 << (NS_ATTRVALUE_ENUMTABLEINDEX_BITS - 1))
|
||||
#define NS_ATTRVALUE_ENUMTABLEINDEX_MAXVALUE (NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER - 1)
|
||||
#define NS_ATTRVALUE_ENUMTABLEINDEX_MASK \
|
||||
(PtrBits((((1 << NS_ATTRVALUE_ENUMTABLEINDEX_BITS) - 1) &~ NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER)))
|
||||
(uintptr_t((((1 << NS_ATTRVALUE_ENUMTABLEINDEX_BITS) - 1) &~ NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER)))
|
||||
|
||||
/**
|
||||
* A class used to construct a nsString from a nsStringBuffer (we might
|
||||
@@ -428,7 +427,7 @@ private:
|
||||
|
||||
static nsTArray<const EnumTable*, nsTArrayDefaultAllocator>* sEnumTableArray;
|
||||
|
||||
PtrBits mBits;
|
||||
uintptr_t mBits;
|
||||
};
|
||||
|
||||
inline const nsAttrValue&
|
||||
|
||||
@@ -57,8 +57,6 @@ class nsDOMTokenList;
|
||||
class ContentUnbinder;
|
||||
struct nsRect;
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
|
||||
/**
|
||||
* A generic base class for DOM elements, implementing many nsIContent,
|
||||
* nsIDOMNode and nsIDOMElement methods.
|
||||
|
||||
@@ -1123,7 +1123,7 @@ nsINode::Trace(nsINode *tmp, TraceCallback cb, void *closure)
|
||||
bool
|
||||
nsINode::UnoptimizableCCNode() const
|
||||
{
|
||||
const PtrBits problematicFlags = (NODE_IS_ANONYMOUS |
|
||||
const uintptr_t problematicFlags = (NODE_IS_ANONYMOUS |
|
||||
NODE_IS_IN_ANONYMOUS_SUBTREE |
|
||||
NODE_IS_NATIVE_ANONYMOUS_ROOT |
|
||||
NODE_MAY_BE_IN_BINDING_MNGR |
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsIAtom;
|
||||
typedef uintptr_t PtrBits;
|
||||
|
||||
typedef void
|
||||
(*NSPropertyFunc)(void *aObject,
|
||||
|
||||
@@ -2434,9 +2434,9 @@ nsDOMClassInfo::Init()
|
||||
{
|
||||
/* Errors that can trigger early returns are done first,
|
||||
otherwise nsDOMClassInfo is left in a half inited state. */
|
||||
NS_ASSERTION(sizeof(PtrBits) == sizeof(void*),
|
||||
"BAD! You'll need to adjust the size of PtrBits to the size "
|
||||
"of a pointer on your platform.");
|
||||
MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
|
||||
"BAD! You'll need to adjust the size of uintptr_t to the "
|
||||
"size of a pointer on your platform.");
|
||||
|
||||
NS_ENSURE_TRUE(!sIsInitialized, NS_ERROR_ALREADY_INITIALIZED);
|
||||
|
||||
|
||||
@@ -82,14 +82,12 @@ struct nsExternalDOMClassInfoData : public nsDOMClassInfoData
|
||||
};
|
||||
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
|
||||
// To be used with the nsDOMClassInfoData::mCachedClassInfo pointer.
|
||||
// The low bit is set when we created a generic helper for an external
|
||||
// (which holds on to the nsDOMClassInfoData).
|
||||
#define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(PtrBits(_ptr) & ~0x1)
|
||||
#define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(PtrBits(_ptr) | 0x1)
|
||||
#define IS_EXTERNAL(_ptr) (PtrBits(_ptr) & 0x1)
|
||||
#define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) & ~0x1)
|
||||
#define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) | 0x1)
|
||||
#define IS_EXTERNAL(_ptr) (uintptr_t(_ptr) & 0x1)
|
||||
|
||||
|
||||
class nsDOMClassInfo : public nsXPCClassInfo
|
||||
|
||||
@@ -12,8 +12,6 @@ struct JSObject;
|
||||
struct JSContext;
|
||||
class XPCWrappedNativeScope;
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace workers {
|
||||
@@ -183,7 +181,7 @@ private:
|
||||
}
|
||||
void SetWrapperBits(void *aWrapper)
|
||||
{
|
||||
mWrapperPtrBits = reinterpret_cast<PtrBits>(aWrapper) |
|
||||
mWrapperPtrBits = reinterpret_cast<uintptr_t>(aWrapper) |
|
||||
(mWrapperPtrBits & WRAPPER_IS_DOM_BINDING);
|
||||
}
|
||||
|
||||
@@ -208,7 +206,7 @@ private:
|
||||
|
||||
enum { kWrapperBitMask = (WRAPPER_BIT_PRESERVED | WRAPPER_IS_DOM_BINDING) };
|
||||
|
||||
PtrBits mWrapperPtrBits;
|
||||
uintptr_t mWrapperPtrBits;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsWrapperCache, NS_WRAPPERCACHE_IID)
|
||||
|
||||
@@ -89,7 +89,7 @@ DOMBindingBase::SetJSObject(JSObject* aObject)
|
||||
// method.
|
||||
SetWrapper(aObject);
|
||||
|
||||
PtrBits oldWrapperPtrBits = mWrapperPtrBits;
|
||||
uintptr_t oldWrapperPtrBits = mWrapperPtrBits;
|
||||
|
||||
SetWrapperBits(aObject);
|
||||
|
||||
|
||||
@@ -3000,7 +3000,7 @@ gfxGlyphExtents::GlyphWidths::~GlyphWidths()
|
||||
{
|
||||
uint32_t i, count = mBlocks.Length();
|
||||
for (i = 0; i < count; ++i) {
|
||||
PtrBits bits = mBlocks[i];
|
||||
uintptr_t bits = mBlocks[i];
|
||||
if (bits && !(bits & 0x1)) {
|
||||
delete[] reinterpret_cast<uint16_t *>(bits);
|
||||
}
|
||||
@@ -3013,7 +3013,7 @@ gfxGlyphExtents::GlyphWidths::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeO
|
||||
uint32_t i;
|
||||
uint32_t size = mBlocks.SizeOfExcludingThis(aMallocSizeOf);
|
||||
for (i = 0; i < mBlocks.Length(); ++i) {
|
||||
PtrBits bits = mBlocks[i];
|
||||
uintptr_t bits = mBlocks[i];
|
||||
if (bits && !(bits & 0x1)) {
|
||||
size += aMallocSizeOf(reinterpret_cast<void*>(bits));
|
||||
}
|
||||
@@ -3027,13 +3027,13 @@ gfxGlyphExtents::GlyphWidths::Set(uint32_t aGlyphID, uint16_t aWidth)
|
||||
uint32_t block = aGlyphID >> BLOCK_SIZE_BITS;
|
||||
uint32_t len = mBlocks.Length();
|
||||
if (block >= len) {
|
||||
PtrBits *elems = mBlocks.AppendElements(block + 1 - len);
|
||||
uintptr_t *elems = mBlocks.AppendElements(block + 1 - len);
|
||||
if (!elems)
|
||||
return;
|
||||
memset(elems, 0, sizeof(PtrBits)*(block + 1 - len));
|
||||
memset(elems, 0, sizeof(uintptr_t)*(block + 1 - len));
|
||||
}
|
||||
|
||||
PtrBits bits = mBlocks[block];
|
||||
uintptr_t bits = mBlocks[block];
|
||||
uint32_t glyphOffset = aGlyphID & (BLOCK_SIZE - 1);
|
||||
if (!bits) {
|
||||
mBlocks[block] = MakeSingle(glyphOffset, aWidth);
|
||||
@@ -3052,7 +3052,7 @@ gfxGlyphExtents::GlyphWidths::Set(uint32_t aGlyphID, uint16_t aWidth)
|
||||
newBlock[i] = INVALID_WIDTH;
|
||||
}
|
||||
newBlock[GetGlyphOffset(bits)] = GetWidth(bits);
|
||||
mBlocks[block] = reinterpret_cast<PtrBits>(newBlock);
|
||||
mBlocks[block] = reinterpret_cast<uintptr_t>(newBlock);
|
||||
} else {
|
||||
newBlock = reinterpret_cast<uint16_t *>(bits);
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,6 @@ private:
|
||||
float x, y, width, height;
|
||||
};
|
||||
|
||||
typedef uintptr_t PtrBits;
|
||||
enum { BLOCK_SIZE_BITS = 7, BLOCK_SIZE = 1 << BLOCK_SIZE_BITS }; // 128-glyph blocks
|
||||
|
||||
class GlyphWidths {
|
||||
@@ -1073,7 +1072,7 @@ private:
|
||||
uint32_t block = aIndex >> BLOCK_SIZE_BITS;
|
||||
if (block >= mBlocks.Length())
|
||||
return INVALID_WIDTH;
|
||||
PtrBits bits = mBlocks[block];
|
||||
uintptr_t bits = mBlocks[block];
|
||||
if (!bits)
|
||||
return INVALID_WIDTH;
|
||||
uint32_t indexInBlock = aIndex & (BLOCK_SIZE - 1);
|
||||
@@ -1091,19 +1090,19 @@ private:
|
||||
~GlyphWidths();
|
||||
|
||||
private:
|
||||
static uint32_t GetGlyphOffset(PtrBits aBits) {
|
||||
static uint32_t GetGlyphOffset(uintptr_t aBits) {
|
||||
NS_ASSERTION(aBits & 0x1, "This is really a pointer...");
|
||||
return (aBits >> 1) & ((1 << BLOCK_SIZE_BITS) - 1);
|
||||
}
|
||||
static uint32_t GetWidth(PtrBits aBits) {
|
||||
static uint32_t GetWidth(uintptr_t aBits) {
|
||||
NS_ASSERTION(aBits & 0x1, "This is really a pointer...");
|
||||
return aBits >> (1 + BLOCK_SIZE_BITS);
|
||||
}
|
||||
static PtrBits MakeSingle(uint32_t aGlyphOffset, uint16_t aWidth) {
|
||||
static uintptr_t MakeSingle(uint32_t aGlyphOffset, uint16_t aWidth) {
|
||||
return (aWidth << (1 + BLOCK_SIZE_BITS)) + (aGlyphOffset << 1) + 1;
|
||||
}
|
||||
|
||||
nsTArray<PtrBits> mBlocks;
|
||||
nsTArray<uintptr_t> mBlocks;
|
||||
};
|
||||
|
||||
GlyphWidths mContainedGlyphWidths;
|
||||
|
||||
@@ -3870,7 +3870,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
|
||||
}
|
||||
|
||||
static void
|
||||
SetFlagsOnSubtree(nsIContent *aNode, PtrBits aFlagsToSet)
|
||||
SetFlagsOnSubtree(nsIContent *aNode, uintptr_t aFlagsToSet)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Make sure that the node passed to us doesn't have any XBL children
|
||||
|
||||
@@ -363,9 +363,9 @@ Initialize()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ASSERTION(sizeof(PtrBits) == sizeof(void *),
|
||||
"Eeek! You'll need to adjust the size of PtrBits to the size "
|
||||
"of a pointer on your platform.");
|
||||
MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
|
||||
"Eeek! You'll need to adjust the size of uintptr_t to the "
|
||||
"size of a pointer on your platform.");
|
||||
|
||||
gInitialized = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user