mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
Rename TypeSet::clone to TypeSet::cloneIntoUninitialized to indicate that it freshly initializes the TemporaryTypeSet* provided to it.
Also removes existing code that, quite unnecessarily, partly initialized that argument.
This commit is contained in:
parent
74983ef77e
commit
7ccaa52ace
2 changed files with 11 additions and 9 deletions
|
|
@ -12,6 +12,8 @@
|
||||||
#include "mozilla/SizePrintfMacros.h"
|
#include "mozilla/SizePrintfMacros.h"
|
||||||
#include "mozilla/Sprintf.h"
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jscntxt.h"
|
#include "jscntxt.h"
|
||||||
#include "jsgc.h"
|
#include "jsgc.h"
|
||||||
|
|
@ -859,10 +861,8 @@ TypeSet::IsTypeAboutToBeFinalized(TypeSet::Type* v)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TypeSet::clone(LifoAlloc* alloc, TemporaryTypeSet* result) const
|
TypeSet::cloneIntoUninitialized(LifoAlloc* alloc, TemporaryTypeSet* result) const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(result->empty());
|
|
||||||
|
|
||||||
unsigned objectCount = baseObjectCount();
|
unsigned objectCount = baseObjectCount();
|
||||||
unsigned capacity = (objectCount >= 2) ? TypeHashSet::Capacity(objectCount) : 0;
|
unsigned capacity = (objectCount >= 2) ? TypeHashSet::Capacity(objectCount) : 0;
|
||||||
|
|
||||||
|
|
@ -881,8 +881,8 @@ TypeSet::clone(LifoAlloc* alloc, TemporaryTypeSet* result) const
|
||||||
TemporaryTypeSet*
|
TemporaryTypeSet*
|
||||||
TypeSet::clone(LifoAlloc* alloc) const
|
TypeSet::clone(LifoAlloc* alloc) const
|
||||||
{
|
{
|
||||||
TemporaryTypeSet* res = alloc->new_<TemporaryTypeSet>();
|
TemporaryTypeSet* res = alloc->pod_malloc<TemporaryTypeSet>();
|
||||||
if (!res || !clone(alloc, res))
|
if (!res || !cloneIntoUninitialized(alloc, res))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -1150,10 +1150,9 @@ TypeScript::FreezeTypeSets(CompilerConstraintList* constraints, JSScript* script
|
||||||
TemporaryTypeSet* types = alloc->newArrayUninitialized<TemporaryTypeSet>(count);
|
TemporaryTypeSet* types = alloc->newArrayUninitialized<TemporaryTypeSet>(count);
|
||||||
if (!types)
|
if (!types)
|
||||||
return false;
|
return false;
|
||||||
PodZero(types, count);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
if (!existing[i].clone(alloc, &types[i]))
|
if (!existing[i].cloneIntoUninitialized(alloc, &types[i]))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -498,7 +498,10 @@ class TypeSet
|
||||||
|
|
||||||
// Clone a type set into an arbitrary allocator.
|
// Clone a type set into an arbitrary allocator.
|
||||||
TemporaryTypeSet* clone(LifoAlloc* alloc) const;
|
TemporaryTypeSet* clone(LifoAlloc* alloc) const;
|
||||||
bool clone(LifoAlloc* alloc, TemporaryTypeSet* result) const;
|
|
||||||
|
// |*result| is not even partly initialized when this function is called:
|
||||||
|
// this function placement-new's its contents into existence.
|
||||||
|
bool cloneIntoUninitialized(LifoAlloc* alloc, TemporaryTypeSet* result) const;
|
||||||
|
|
||||||
// Create a new TemporaryTypeSet where undefined and/or null has been filtered out.
|
// Create a new TemporaryTypeSet where undefined and/or null has been filtered out.
|
||||||
TemporaryTypeSet* filter(LifoAlloc* alloc, bool filterUndefined, bool filterNull) const;
|
TemporaryTypeSet* filter(LifoAlloc* alloc, bool filterUndefined, bool filterNull) const;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue