Bug 1021229 - hoist enoughMemory_ into AssemblerShared (r=jandem)

--HG--
extra : rebase_source : 2f04773c01e3bf3850cede67243a3508349ed38a
This commit is contained in:
Luke Wagner 2014-06-06 15:45:04 -05:00
Родитель 916aa7eb2c
Коммит 9634c25784
11 изменённых файлов: 31 добавлений и 62 удалений

Просмотреть файл

@ -177,7 +177,6 @@ class MacroAssembler : public MacroAssemblerSpecific
mozilla::Maybe<AutoRooter> autoRooter_;
mozilla::Maybe<IonContext> ionContext_;
mozilla::Maybe<AutoIonContextAlloc> alloc_;
bool enoughMemory_;
bool embedsNurseryPointers_;
// SPS instrumentation, only used for Ion caches.
@ -201,8 +200,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// provided, but otherwise it can be safely omitted to prevent all
// instrumentation from being emitted.
MacroAssembler()
: enoughMemory_(true),
embedsNurseryPointers_(false),
: embedsNurseryPointers_(false),
sps_(nullptr)
{
IonContext *icx = GetIonContext();
@ -226,8 +224,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// (for example, Trampoline-$(ARCH).cpp and IonCaches.cpp).
explicit MacroAssembler(JSContext *cx, IonScript *ion = nullptr,
JSScript *script = nullptr, jsbytecode *pc = nullptr)
: enoughMemory_(true),
embedsNurseryPointers_(false),
: embedsNurseryPointers_(false),
sps_(nullptr)
{
constructRoot(cx);
@ -254,8 +251,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// asm.js compilation handles its own IonContext-pushing
struct AsmJSToken {};
explicit MacroAssembler(AsmJSToken)
: enoughMemory_(true),
embedsNurseryPointers_(false),
: embedsNurseryPointers_(false),
sps_(nullptr)
{
#ifdef JS_CODEGEN_ARM
@ -286,13 +282,6 @@ class MacroAssembler : public MacroAssemblerSpecific
return size();
}
void propagateOOM(bool success) {
enoughMemory_ &= success;
}
bool oom() const {
return !enoughMemory_ || MacroAssemblerSpecific::oom();
}
bool embedsNurseryPointers() const {
return embedsNurseryPointers_;
}

Просмотреть файл

@ -1255,11 +1255,11 @@ VFPRegister::isMissing()
bool
Assembler::oom() const
{
return m_buffer.oom() ||
!enoughMemory_ ||
jumpRelocations_.oom() ||
dataRelocations_.oom() ||
preBarriers_.oom();
return AssemblerShared::oom() ||
m_buffer.oom() ||
jumpRelocations_.oom() ||
dataRelocations_.oom() ||
preBarriers_.oom();
}
bool

Просмотреть файл

@ -1265,8 +1265,6 @@ class Assembler : public AssemblerShared
CompactBufferWriter relocations_;
CompactBufferWriter preBarriers_;
bool enoughMemory_;
//typedef JSC::AssemblerBufferWithConstantPool<1024, 4, 4, js::jit::Assembler> ARMBuffer;
ARMBuffer m_buffer;
@ -1286,8 +1284,7 @@ class Assembler : public AssemblerShared
public:
Assembler()
: enoughMemory_(true),
m_buffer(4, 4, 0, &pools_[0], 8),
: m_buffer(4, 4, 0, &pools_[0], 8),
int32Pool(m_buffer.getPool(1)),
doublePool(m_buffer.getPool(0)),
isFinished(false),

Просмотреть файл

@ -476,8 +476,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
#endif
bool dynamicAlignment_;
bool enoughMemory_;
// Used to work around the move resolver's lack of support for
// moving into register pairs, which the softfp ABI needs.
mozilla::Array<MoveOperand, 2> floatArgsInGPR;
@ -505,12 +503,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
public:
MacroAssemblerARMCompat()
: inCall_(false),
enoughMemory_(true),
framePushed_(0)
{ }
bool oom() const {
return Assembler::oom() || !enoughMemory_;
}
public:
using MacroAssemblerARM::call;

Просмотреть файл

@ -434,8 +434,8 @@ BOffImm16::BOffImm16(InstImm inst)
bool
Assembler::oom() const
{
return m_buffer.oom() ||
!enoughMemory_ ||
return AssemblerShared::oom() ||
m_buffer.oom() ||
jumpRelocations_.oom() ||
dataRelocations_.oom() ||
preBarriers_.oom();

Просмотреть файл

@ -724,14 +724,11 @@ class Assembler : public AssemblerShared
CompactBufferWriter relocations_;
CompactBufferWriter preBarriers_;
bool enoughMemory_;
MIPSBuffer m_buffer;
public:
Assembler()
: enoughMemory_(true),
m_buffer(),
: m_buffer(),
isFinished(false)
{ }

Просмотреть файл

@ -340,7 +340,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
bool dynamicAlignment_;
bool enoughMemory_;
// Compute space needed for the function call and set the properties of the
// callee. It returns the space which has to be allocated for calling the
// function.
@ -363,12 +362,8 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
public:
MacroAssemblerMIPSCompat()
: inCall_(false),
enoughMemory_(true),
framePushed_(0)
{ }
bool oom() const {
return Assembler::oom();
}
public:
using MacroAssemblerMIPS::call;

Просмотреть файл

@ -805,7 +805,22 @@ class AssemblerShared
Vector<AsmJSGlobalAccess, 0, SystemAllocPolicy> asmJSGlobalAccesses_;
Vector<AsmJSAbsoluteLink, 0, SystemAllocPolicy> asmJSAbsoluteLinks_;
protected:
bool enoughMemory_;
public:
AssemblerShared()
: enoughMemory_(true)
{}
void propagateOOM(bool success) {
enoughMemory_ &= success;
}
bool oom() const {
return !enoughMemory_;
}
bool append(CallSite callsite) { return callsites_.append(callsite); }
CallSiteVector &&extractCallSites() { return Move(callsites_); }

Просмотреть файл

@ -144,7 +144,6 @@ class AssemblerX86Shared : public AssemblerShared
CompactBufferWriter jumpRelocations_;
CompactBufferWriter dataRelocations_;
CompactBufferWriter preBarriers_;
bool enoughMemory_;
void writeDataRelocation(const Value &val) {
if (val.isMarkable()) {
@ -255,11 +254,6 @@ class AssemblerX86Shared : public AssemblerShared
BelowOrEqual | Parity | NoParity) & DoubleConditionBits));
}
AssemblerX86Shared()
: enoughMemory_(true)
{
}
static Condition InvertCondition(Condition cond);
// Return the primary condition to test. Some primary conditions may not
@ -275,8 +269,8 @@ class AssemblerX86Shared : public AssemblerShared
void trace(JSTracer *trc);
bool oom() const {
return masm.oom() ||
!enoughMemory_ ||
return AssemblerShared::oom() ||
masm.oom() ||
jumpRelocations_.oom() ||
dataRelocations_.oom() ||
preBarriers_.oom();

Просмотреть файл

@ -42,7 +42,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
uint32_t passedFloatArgs_;
uint32_t stackForCall_;
bool dynamicAlignment_;
bool enoughMemory_;
// These use SystemAllocPolicy since asm.js releases memory after each
// function is compiled, and these need to live until after all functions
@ -83,8 +82,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
using MacroAssemblerX86Shared::store32;
MacroAssemblerX64()
: inCall_(false),
enoughMemory_(true)
: inCall_(false)
{
}
@ -92,10 +90,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
// bookkeeping has been flushed to the instruction stream.
void finish();
bool oom() const {
return MacroAssemblerX86Shared::oom() || !enoughMemory_;
}
/////////////////////////////////////////////////////////////////
// X64 helpers.
/////////////////////////////////////////////////////////////////

Просмотреть файл

@ -25,7 +25,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
uint32_t passedArgs_;
uint32_t stackForCall_;
bool dynamicAlignment_;
bool enoughMemory_;
struct Double {
double value;
@ -75,8 +74,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
using MacroAssemblerX86Shared::call;
MacroAssemblerX86()
: inCall_(false),
enoughMemory_(true)
: inCall_(false)
{
}
@ -84,10 +82,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
// bookkeeping has been flushed to the instruction stream.
void finish();
bool oom() const {
return MacroAssemblerX86Shared::oom() || !enoughMemory_;
}
/////////////////////////////////////////////////////////////////
// X86-specific interface.
/////////////////////////////////////////////////////////////////