зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1021229 - hoist enoughMemory_ into AssemblerShared (r=jandem)
--HG-- extra : rebase_source : 2f04773c01e3bf3850cede67243a3508349ed38a
This commit is contained in:
Родитель
916aa7eb2c
Коммит
9634c25784
|
@ -177,7 +177,6 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||||
mozilla::Maybe<AutoRooter> autoRooter_;
|
mozilla::Maybe<AutoRooter> autoRooter_;
|
||||||
mozilla::Maybe<IonContext> ionContext_;
|
mozilla::Maybe<IonContext> ionContext_;
|
||||||
mozilla::Maybe<AutoIonContextAlloc> alloc_;
|
mozilla::Maybe<AutoIonContextAlloc> alloc_;
|
||||||
bool enoughMemory_;
|
|
||||||
bool embedsNurseryPointers_;
|
bool embedsNurseryPointers_;
|
||||||
|
|
||||||
// SPS instrumentation, only used for Ion caches.
|
// 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
|
// provided, but otherwise it can be safely omitted to prevent all
|
||||||
// instrumentation from being emitted.
|
// instrumentation from being emitted.
|
||||||
MacroAssembler()
|
MacroAssembler()
|
||||||
: enoughMemory_(true),
|
: embedsNurseryPointers_(false),
|
||||||
embedsNurseryPointers_(false),
|
|
||||||
sps_(nullptr)
|
sps_(nullptr)
|
||||||
{
|
{
|
||||||
IonContext *icx = GetIonContext();
|
IonContext *icx = GetIonContext();
|
||||||
|
@ -226,8 +224,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||||
// (for example, Trampoline-$(ARCH).cpp and IonCaches.cpp).
|
// (for example, Trampoline-$(ARCH).cpp and IonCaches.cpp).
|
||||||
explicit MacroAssembler(JSContext *cx, IonScript *ion = nullptr,
|
explicit MacroAssembler(JSContext *cx, IonScript *ion = nullptr,
|
||||||
JSScript *script = nullptr, jsbytecode *pc = nullptr)
|
JSScript *script = nullptr, jsbytecode *pc = nullptr)
|
||||||
: enoughMemory_(true),
|
: embedsNurseryPointers_(false),
|
||||||
embedsNurseryPointers_(false),
|
|
||||||
sps_(nullptr)
|
sps_(nullptr)
|
||||||
{
|
{
|
||||||
constructRoot(cx);
|
constructRoot(cx);
|
||||||
|
@ -254,8 +251,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||||
// asm.js compilation handles its own IonContext-pushing
|
// asm.js compilation handles its own IonContext-pushing
|
||||||
struct AsmJSToken {};
|
struct AsmJSToken {};
|
||||||
explicit MacroAssembler(AsmJSToken)
|
explicit MacroAssembler(AsmJSToken)
|
||||||
: enoughMemory_(true),
|
: embedsNurseryPointers_(false),
|
||||||
embedsNurseryPointers_(false),
|
|
||||||
sps_(nullptr)
|
sps_(nullptr)
|
||||||
{
|
{
|
||||||
#ifdef JS_CODEGEN_ARM
|
#ifdef JS_CODEGEN_ARM
|
||||||
|
@ -286,13 +282,6 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||||
return size();
|
return size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void propagateOOM(bool success) {
|
|
||||||
enoughMemory_ &= success;
|
|
||||||
}
|
|
||||||
bool oom() const {
|
|
||||||
return !enoughMemory_ || MacroAssemblerSpecific::oom();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool embedsNurseryPointers() const {
|
bool embedsNurseryPointers() const {
|
||||||
return embedsNurseryPointers_;
|
return embedsNurseryPointers_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1255,11 +1255,11 @@ VFPRegister::isMissing()
|
||||||
bool
|
bool
|
||||||
Assembler::oom() const
|
Assembler::oom() const
|
||||||
{
|
{
|
||||||
return m_buffer.oom() ||
|
return AssemblerShared::oom() ||
|
||||||
!enoughMemory_ ||
|
m_buffer.oom() ||
|
||||||
jumpRelocations_.oom() ||
|
jumpRelocations_.oom() ||
|
||||||
dataRelocations_.oom() ||
|
dataRelocations_.oom() ||
|
||||||
preBarriers_.oom();
|
preBarriers_.oom();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -1265,8 +1265,6 @@ class Assembler : public AssemblerShared
|
||||||
CompactBufferWriter relocations_;
|
CompactBufferWriter relocations_;
|
||||||
CompactBufferWriter preBarriers_;
|
CompactBufferWriter preBarriers_;
|
||||||
|
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
//typedef JSC::AssemblerBufferWithConstantPool<1024, 4, 4, js::jit::Assembler> ARMBuffer;
|
//typedef JSC::AssemblerBufferWithConstantPool<1024, 4, 4, js::jit::Assembler> ARMBuffer;
|
||||||
ARMBuffer m_buffer;
|
ARMBuffer m_buffer;
|
||||||
|
|
||||||
|
@ -1286,8 +1284,7 @@ class Assembler : public AssemblerShared
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Assembler()
|
Assembler()
|
||||||
: enoughMemory_(true),
|
: m_buffer(4, 4, 0, &pools_[0], 8),
|
||||||
m_buffer(4, 4, 0, &pools_[0], 8),
|
|
||||||
int32Pool(m_buffer.getPool(1)),
|
int32Pool(m_buffer.getPool(1)),
|
||||||
doublePool(m_buffer.getPool(0)),
|
doublePool(m_buffer.getPool(0)),
|
||||||
isFinished(false),
|
isFinished(false),
|
||||||
|
|
|
@ -476,8 +476,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||||
#endif
|
#endif
|
||||||
bool dynamicAlignment_;
|
bool dynamicAlignment_;
|
||||||
|
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
// Used to work around the move resolver's lack of support for
|
// Used to work around the move resolver's lack of support for
|
||||||
// moving into register pairs, which the softfp ABI needs.
|
// moving into register pairs, which the softfp ABI needs.
|
||||||
mozilla::Array<MoveOperand, 2> floatArgsInGPR;
|
mozilla::Array<MoveOperand, 2> floatArgsInGPR;
|
||||||
|
@ -505,12 +503,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||||
public:
|
public:
|
||||||
MacroAssemblerARMCompat()
|
MacroAssemblerARMCompat()
|
||||||
: inCall_(false),
|
: inCall_(false),
|
||||||
enoughMemory_(true),
|
|
||||||
framePushed_(0)
|
framePushed_(0)
|
||||||
{ }
|
{ }
|
||||||
bool oom() const {
|
|
||||||
return Assembler::oom() || !enoughMemory_;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using MacroAssemblerARM::call;
|
using MacroAssemblerARM::call;
|
||||||
|
|
|
@ -434,8 +434,8 @@ BOffImm16::BOffImm16(InstImm inst)
|
||||||
bool
|
bool
|
||||||
Assembler::oom() const
|
Assembler::oom() const
|
||||||
{
|
{
|
||||||
return m_buffer.oom() ||
|
return AssemblerShared::oom() ||
|
||||||
!enoughMemory_ ||
|
m_buffer.oom() ||
|
||||||
jumpRelocations_.oom() ||
|
jumpRelocations_.oom() ||
|
||||||
dataRelocations_.oom() ||
|
dataRelocations_.oom() ||
|
||||||
preBarriers_.oom();
|
preBarriers_.oom();
|
||||||
|
|
|
@ -724,14 +724,11 @@ class Assembler : public AssemblerShared
|
||||||
CompactBufferWriter relocations_;
|
CompactBufferWriter relocations_;
|
||||||
CompactBufferWriter preBarriers_;
|
CompactBufferWriter preBarriers_;
|
||||||
|
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
MIPSBuffer m_buffer;
|
MIPSBuffer m_buffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Assembler()
|
Assembler()
|
||||||
: enoughMemory_(true),
|
: m_buffer(),
|
||||||
m_buffer(),
|
|
||||||
isFinished(false)
|
isFinished(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||||
|
|
||||||
bool dynamicAlignment_;
|
bool dynamicAlignment_;
|
||||||
|
|
||||||
bool enoughMemory_;
|
|
||||||
// Compute space needed for the function call and set the properties of the
|
// 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
|
// callee. It returns the space which has to be allocated for calling the
|
||||||
// function.
|
// function.
|
||||||
|
@ -363,12 +362,8 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||||
public:
|
public:
|
||||||
MacroAssemblerMIPSCompat()
|
MacroAssemblerMIPSCompat()
|
||||||
: inCall_(false),
|
: inCall_(false),
|
||||||
enoughMemory_(true),
|
|
||||||
framePushed_(0)
|
framePushed_(0)
|
||||||
{ }
|
{ }
|
||||||
bool oom() const {
|
|
||||||
return Assembler::oom();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using MacroAssemblerMIPS::call;
|
using MacroAssemblerMIPS::call;
|
||||||
|
|
|
@ -805,7 +805,22 @@ class AssemblerShared
|
||||||
Vector<AsmJSGlobalAccess, 0, SystemAllocPolicy> asmJSGlobalAccesses_;
|
Vector<AsmJSGlobalAccess, 0, SystemAllocPolicy> asmJSGlobalAccesses_;
|
||||||
Vector<AsmJSAbsoluteLink, 0, SystemAllocPolicy> asmJSAbsoluteLinks_;
|
Vector<AsmJSAbsoluteLink, 0, SystemAllocPolicy> asmJSAbsoluteLinks_;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool enoughMemory_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
AssemblerShared()
|
||||||
|
: enoughMemory_(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void propagateOOM(bool success) {
|
||||||
|
enoughMemory_ &= success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oom() const {
|
||||||
|
return !enoughMemory_;
|
||||||
|
}
|
||||||
|
|
||||||
bool append(CallSite callsite) { return callsites_.append(callsite); }
|
bool append(CallSite callsite) { return callsites_.append(callsite); }
|
||||||
CallSiteVector &&extractCallSites() { return Move(callsites_); }
|
CallSiteVector &&extractCallSites() { return Move(callsites_); }
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ class AssemblerX86Shared : public AssemblerShared
|
||||||
CompactBufferWriter jumpRelocations_;
|
CompactBufferWriter jumpRelocations_;
|
||||||
CompactBufferWriter dataRelocations_;
|
CompactBufferWriter dataRelocations_;
|
||||||
CompactBufferWriter preBarriers_;
|
CompactBufferWriter preBarriers_;
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
void writeDataRelocation(const Value &val) {
|
void writeDataRelocation(const Value &val) {
|
||||||
if (val.isMarkable()) {
|
if (val.isMarkable()) {
|
||||||
|
@ -255,11 +254,6 @@ class AssemblerX86Shared : public AssemblerShared
|
||||||
BelowOrEqual | Parity | NoParity) & DoubleConditionBits));
|
BelowOrEqual | Parity | NoParity) & DoubleConditionBits));
|
||||||
}
|
}
|
||||||
|
|
||||||
AssemblerX86Shared()
|
|
||||||
: enoughMemory_(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static Condition InvertCondition(Condition cond);
|
static Condition InvertCondition(Condition cond);
|
||||||
|
|
||||||
// Return the primary condition to test. Some primary conditions may not
|
// Return the primary condition to test. Some primary conditions may not
|
||||||
|
@ -275,8 +269,8 @@ class AssemblerX86Shared : public AssemblerShared
|
||||||
void trace(JSTracer *trc);
|
void trace(JSTracer *trc);
|
||||||
|
|
||||||
bool oom() const {
|
bool oom() const {
|
||||||
return masm.oom() ||
|
return AssemblerShared::oom() ||
|
||||||
!enoughMemory_ ||
|
masm.oom() ||
|
||||||
jumpRelocations_.oom() ||
|
jumpRelocations_.oom() ||
|
||||||
dataRelocations_.oom() ||
|
dataRelocations_.oom() ||
|
||||||
preBarriers_.oom();
|
preBarriers_.oom();
|
||||||
|
|
|
@ -42,7 +42,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||||
uint32_t passedFloatArgs_;
|
uint32_t passedFloatArgs_;
|
||||||
uint32_t stackForCall_;
|
uint32_t stackForCall_;
|
||||||
bool dynamicAlignment_;
|
bool dynamicAlignment_;
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
// These use SystemAllocPolicy since asm.js releases memory after each
|
// These use SystemAllocPolicy since asm.js releases memory after each
|
||||||
// function is compiled, and these need to live until after all functions
|
// function is compiled, and these need to live until after all functions
|
||||||
|
@ -83,8 +82,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||||
using MacroAssemblerX86Shared::store32;
|
using MacroAssemblerX86Shared::store32;
|
||||||
|
|
||||||
MacroAssemblerX64()
|
MacroAssemblerX64()
|
||||||
: inCall_(false),
|
: inCall_(false)
|
||||||
enoughMemory_(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +90,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||||
// bookkeeping has been flushed to the instruction stream.
|
// bookkeeping has been flushed to the instruction stream.
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
bool oom() const {
|
|
||||||
return MacroAssemblerX86Shared::oom() || !enoughMemory_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// X64 helpers.
|
// X64 helpers.
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -25,7 +25,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||||
uint32_t passedArgs_;
|
uint32_t passedArgs_;
|
||||||
uint32_t stackForCall_;
|
uint32_t stackForCall_;
|
||||||
bool dynamicAlignment_;
|
bool dynamicAlignment_;
|
||||||
bool enoughMemory_;
|
|
||||||
|
|
||||||
struct Double {
|
struct Double {
|
||||||
double value;
|
double value;
|
||||||
|
@ -75,8 +74,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||||
using MacroAssemblerX86Shared::call;
|
using MacroAssemblerX86Shared::call;
|
||||||
|
|
||||||
MacroAssemblerX86()
|
MacroAssemblerX86()
|
||||||
: inCall_(false),
|
: inCall_(false)
|
||||||
enoughMemory_(true)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,10 +82,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
||||||
// bookkeeping has been flushed to the instruction stream.
|
// bookkeeping has been flushed to the instruction stream.
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
bool oom() const {
|
|
||||||
return MacroAssemblerX86Shared::oom() || !enoughMemory_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// X86-specific interface.
|
// X86-specific interface.
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
Загрузка…
Ссылка в новой задаче