зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1073096 - Use MemoryBarrierBits type as container for bit sets. r=luke
This commit is contained in:
Родитель
9753923d45
Коммит
acb8760d78
|
@ -35,18 +35,37 @@ enum MemoryBarrierBits {
|
|||
MembarSynchronizing = 16,
|
||||
|
||||
// For validity testing
|
||||
MembarNobits = 0,
|
||||
MembarAllbits = 31,
|
||||
};
|
||||
|
||||
inline MemoryBarrierBits
|
||||
operator|(MemoryBarrierBits a, MemoryBarrierBits b)
|
||||
{
|
||||
return MemoryBarrierBits(int(a) | int(b));
|
||||
}
|
||||
|
||||
inline MemoryBarrierBits
|
||||
operator&(MemoryBarrierBits a, MemoryBarrierBits b)
|
||||
{
|
||||
return MemoryBarrierBits(int(a) & int(b));
|
||||
}
|
||||
|
||||
inline MemoryBarrierBits
|
||||
operator~(MemoryBarrierBits a)
|
||||
{
|
||||
return MemoryBarrierBits(~int(a));
|
||||
}
|
||||
|
||||
// Standard barrier bits for a full barrier.
|
||||
static const int MembarFull = MembarLoadLoad|MembarLoadStore|MembarStoreLoad|MembarStoreStore;
|
||||
static const MemoryBarrierBits MembarFull = MembarLoadLoad|MembarLoadStore|MembarStoreLoad|MembarStoreStore;
|
||||
|
||||
// Standard sets of barrier bits for atomic loads and stores.
|
||||
// See http://gee.cs.oswego.edu/dl/jmm/cookbook.html for more.
|
||||
static const int MembarBeforeLoad = 0;
|
||||
static const int MembarAfterLoad = MembarLoadLoad|MembarLoadStore;
|
||||
static const int MembarBeforeStore = MembarStoreStore;
|
||||
static const int MembarAfterStore = MembarStoreLoad;
|
||||
static const MemoryBarrierBits MembarBeforeLoad = MembarNobits;
|
||||
static const MemoryBarrierBits MembarAfterLoad = MembarLoadLoad|MembarLoadStore;
|
||||
static const MemoryBarrierBits MembarBeforeStore = MembarStoreStore;
|
||||
static const MemoryBarrierBits MembarAfterStore = MembarStoreLoad;
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
|
|
@ -6874,19 +6874,19 @@ class LThrowUninitializedLexical : public LCallInstructionHelper<0, 0, 0>
|
|||
class LMemoryBarrier : public LInstructionHelper<0, 0, 0>
|
||||
{
|
||||
private:
|
||||
const int type_;
|
||||
const MemoryBarrierBits type_;
|
||||
|
||||
public:
|
||||
LIR_HEADER(MemoryBarrier)
|
||||
|
||||
// The parameter 'type' is a bitwise 'or' of the barrier types needed,
|
||||
// see AtomicOp.h.
|
||||
explicit LMemoryBarrier(int type) : type_(type)
|
||||
explicit LMemoryBarrier(MemoryBarrierBits type) : type_(type)
|
||||
{
|
||||
MOZ_ASSERT((type_ & ~MembarAllbits) == 0);
|
||||
MOZ_ASSERT((type_ & ~MembarAllbits) == MembarNobits);
|
||||
}
|
||||
|
||||
int type() const {
|
||||
MemoryBarrierBits type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
|
|
@ -11930,22 +11930,22 @@ class MMemoryBarrier
|
|||
: public MNullaryInstruction
|
||||
{
|
||||
// The type is a combination of the memory barrier types in AtomicOp.h.
|
||||
const int type_;
|
||||
const MemoryBarrierBits type_;
|
||||
|
||||
explicit MMemoryBarrier(int type)
|
||||
explicit MMemoryBarrier(MemoryBarrierBits type)
|
||||
: type_(type)
|
||||
{
|
||||
MOZ_ASSERT((type_ & ~MembarAllbits) == 0);
|
||||
MOZ_ASSERT((type_ & ~MembarAllbits) == MembarNobits);
|
||||
setGuard(); // Not removable
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(MemoryBarrier);
|
||||
|
||||
static MMemoryBarrier *New(TempAllocator &alloc, int type=MembarFull) {
|
||||
static MMemoryBarrier *New(TempAllocator &alloc, MemoryBarrierBits type = MembarFull) {
|
||||
return new(alloc) MMemoryBarrier(type);
|
||||
}
|
||||
int type() const {
|
||||
MemoryBarrierBits type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
|
|
@ -2250,7 +2250,7 @@ JitRuntime::generateForkJoinGetSliceStub(JSContext *cx)
|
|||
}
|
||||
|
||||
void
|
||||
CodeGeneratorARM::memoryBarrier(int barrier)
|
||||
CodeGeneratorARM::memoryBarrier(MemoryBarrierBits barrier)
|
||||
{
|
||||
// On ARMv6 the optional argument (BarrierST, etc) is ignored.
|
||||
if (barrier == (MembarStoreStore|MembarSynchronizing))
|
||||
|
|
|
@ -181,7 +181,7 @@ class CodeGeneratorARM : public CodeGeneratorShared
|
|||
bool modICommon(MMod *mir, Register lhs, Register rhs, Register output, LSnapshot *snapshot,
|
||||
Label &done);
|
||||
|
||||
void memoryBarrier(int barrier);
|
||||
void memoryBarrier(MemoryBarrierBits barrier);
|
||||
|
||||
public:
|
||||
CodeGeneratorARM(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm);
|
||||
|
|
Загрузка…
Ссылка в новой задаче