mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 876064 - Change HeapLabel with NonAssertingLabel, and don't allocate it on the heap. r=luke
This commit is contained in:
parent
0d71f246d1
commit
d6d845fe83
@ -22,11 +22,7 @@ using namespace js;
|
||||
using namespace js::ion;
|
||||
|
||||
BaselineCompiler::BaselineCompiler(JSContext *cx, HandleScript script)
|
||||
: BaselineCompilerSpecific(cx, script),
|
||||
return_(new HeapLabel())
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
, postBarrierSlot_(new HeapLabel())
|
||||
#endif
|
||||
: BaselineCompilerSpecific(cx, script)
|
||||
{
|
||||
}
|
||||
|
||||
@ -261,7 +257,7 @@ BaselineCompiler::emitPrologue()
|
||||
bool
|
||||
BaselineCompiler::emitEpilogue()
|
||||
{
|
||||
masm.bind(return_);
|
||||
masm.bind(&return_);
|
||||
|
||||
// Pop SPS frame if necessary
|
||||
emitSPSPop();
|
||||
@ -283,7 +279,7 @@ BaselineCompiler::emitEpilogue()
|
||||
bool
|
||||
BaselineCompiler::emitOutOfLinePostBarrierSlot()
|
||||
{
|
||||
masm.bind(postBarrierSlot_);
|
||||
masm.bind(&postBarrierSlot_);
|
||||
|
||||
Register objReg = R2.scratchReg();
|
||||
GeneralRegisterSet regs(GeneralRegisterSet::All());
|
||||
@ -346,7 +342,7 @@ BaselineCompiler::emitDebugPrologue()
|
||||
masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, &done);
|
||||
{
|
||||
masm.loadValue(frame.addressOfReturnValue(), JSReturnOperand);
|
||||
masm.jump(return_);
|
||||
masm.jump(&return_);
|
||||
}
|
||||
masm.bind(&done);
|
||||
return true;
|
||||
@ -1824,7 +1820,7 @@ BaselineCompiler::emit_JSOP_SETALIASEDVAR()
|
||||
masm.branchPtr(Assembler::Below, objReg, ImmWord(nursery.heapEnd()), &skipBarrier);
|
||||
|
||||
masm.bind(&isTenured);
|
||||
masm.call(postBarrierSlot_);
|
||||
masm.call(&postBarrierSlot_);
|
||||
|
||||
masm.bind(&skipBarrier);
|
||||
#endif
|
||||
@ -2489,7 +2485,7 @@ BaselineCompiler::emit_JSOP_DEBUGGER()
|
||||
masm.branchTest32(Assembler::Zero, ReturnReg, ReturnReg, &done);
|
||||
{
|
||||
masm.loadValue(frame.addressOfReturnValue(), JSReturnOperand);
|
||||
masm.jump(return_);
|
||||
masm.jump(&return_);
|
||||
}
|
||||
masm.bind(&done);
|
||||
return true;
|
||||
@ -2522,7 +2518,7 @@ BaselineCompiler::emitReturn()
|
||||
if (JSOp(*pc) != JSOP_STOP) {
|
||||
// JSOP_STOP is immediately followed by the return label, so we don't
|
||||
// need a jump.
|
||||
masm.jump(return_);
|
||||
masm.jump(&return_);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -184,9 +184,9 @@ namespace ion {
|
||||
class BaselineCompiler : public BaselineCompilerSpecific
|
||||
{
|
||||
FixedList<Label> labels_;
|
||||
HeapLabel * return_;
|
||||
NonAssertingLabel return_;
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
HeapLabel * postBarrierSlot_;
|
||||
NonAssertingLabel postBarrierSlot_;
|
||||
#endif
|
||||
|
||||
// Native code offset right before the scope chain is initialized.
|
||||
|
@ -887,7 +887,7 @@ CodeGenerator::visitReturn(LReturn *lir)
|
||||
#endif
|
||||
// Don't emit a jump to the return label if this is the last block.
|
||||
if (current->mir() != *gen->graph().poBegin())
|
||||
masm.jump(returnLabel_);
|
||||
masm.jump(&returnLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -6944,7 +6944,7 @@ CodeGenerator::visitOutOfLineParallelAbort(OutOfLineParallelAbort *ool)
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, ParallelAbort));
|
||||
|
||||
masm.moveValue(MagicValue(JS_ION_ERROR), JSReturnOperand);
|
||||
masm.jump(returnLabel_);
|
||||
masm.jump(&returnLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7004,7 +7004,7 @@ CodeGenerator::visitOutOfLinePropagateParallelAbort(OutOfLinePropagateParallelAb
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, PropagateParallelAbort));
|
||||
|
||||
masm.moveValue(MagicValue(JS_ION_ERROR), JSReturnOperand);
|
||||
masm.jump(returnLabel_);
|
||||
masm.jump(&returnLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7097,7 +7097,7 @@ CodeGenerator::visitAsmJSReturn(LAsmJSReturn *lir)
|
||||
masm.ma_vxfer(d0, r0, r1);
|
||||
#endif
|
||||
if (current->mir() != *gen->graph().poBegin())
|
||||
masm.jump(returnLabel_);
|
||||
masm.jump(&returnLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -7106,7 +7106,7 @@ CodeGenerator::visitAsmJSVoidReturn(LAsmJSVoidReturn *lir)
|
||||
{
|
||||
// Don't emit a jump to the return label if this is the last block.
|
||||
if (current->mir() != *gen->graph().poBegin())
|
||||
masm.jump(returnLabel_);
|
||||
masm.jump(&returnLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,7 @@ using namespace js::ion;
|
||||
|
||||
// shared
|
||||
CodeGeneratorARM::CodeGeneratorARM(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm)
|
||||
: CodeGeneratorShared(gen, graph, masm),
|
||||
deoptLabel_(NULL)
|
||||
: CodeGeneratorShared(gen, graph, masm)
|
||||
{
|
||||
}
|
||||
|
||||
@ -46,17 +45,13 @@ CodeGeneratorARM::generatePrologue()
|
||||
masm.checkStackAlignment();
|
||||
}
|
||||
|
||||
// Allocate returnLabel_ on the heap, so we don't run its destructor and
|
||||
// assert-not-bound in debug mode on compilation failure.
|
||||
returnLabel_ = new HeapLabel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGeneratorARM::generateEpilogue()
|
||||
{
|
||||
masm.bind(returnLabel_);
|
||||
masm.bind(&returnLabel_);
|
||||
if (gen->compilingAsmJS()) {
|
||||
// Pop the stack we allocated at the start of the function.
|
||||
masm.freeStack(frameDepth_);
|
||||
@ -152,9 +147,9 @@ CodeGeneratorARM::generateOutOfLineCode()
|
||||
if (!CodeGeneratorShared::generateOutOfLineCode())
|
||||
return false;
|
||||
|
||||
if (deoptLabel_) {
|
||||
if (deoptLabel_.used()) {
|
||||
// All non-table-based bailouts will go here.
|
||||
masm.bind(deoptLabel_);
|
||||
masm.bind(&deoptLabel_);
|
||||
|
||||
// Push the frame size, so the handler can recover the IonScript.
|
||||
masm.ma_mov(Imm32(frameSize()), lr);
|
||||
@ -264,12 +259,10 @@ CodeGeneratorARM::bailout(LSnapshot *snapshot)
|
||||
bool
|
||||
CodeGeneratorARM::visitOutOfLineBailout(OutOfLineBailout *ool)
|
||||
{
|
||||
if (!deoptLabel_)
|
||||
deoptLabel_ = new HeapLabel();
|
||||
masm.ma_mov(Imm32(ool->snapshot()->snapshotOffset()), ScratchRegister);
|
||||
masm.ma_push(ScratchRegister);
|
||||
masm.ma_push(ScratchRegister);
|
||||
masm.ma_b(deoptLabel_);
|
||||
masm.ma_b(&deoptLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ class CodeGeneratorARM : public CodeGeneratorShared
|
||||
|
||||
protected:
|
||||
// Label for the common return path.
|
||||
HeapLabel *returnLabel_;
|
||||
HeapLabel *deoptLabel_;
|
||||
NonAssertingLabel returnLabel_;
|
||||
NonAssertingLabel deoptLabel_;
|
||||
// ugh. this is not going to be pretty to move over.
|
||||
// stack slotted variables are not useful on arm.
|
||||
// it looks like this will need to return one of two types.
|
||||
|
@ -278,11 +278,19 @@ class Label : public LabelBase
|
||||
}
|
||||
};
|
||||
|
||||
// Wrapper around Label, on the heap, to avoid a bogus assert with OOM.
|
||||
struct HeapLabel
|
||||
: public TempObject,
|
||||
public Label
|
||||
// Label's destructor asserts that if it has been used it has also been bound.
|
||||
// In the case long-lived labels, however, failed compilation (e.g. OOM) will
|
||||
// trigger this failure innocuously. This Label silences the assertion.
|
||||
class NonAssertingLabel : public Label
|
||||
{
|
||||
public:
|
||||
~NonAssertingLabel()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (used())
|
||||
bind(0);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class RepatchLabel
|
||||
|
@ -22,8 +22,7 @@ namespace js {
|
||||
namespace ion {
|
||||
|
||||
CodeGeneratorX86Shared::CodeGeneratorX86Shared(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm)
|
||||
: CodeGeneratorShared(gen, graph, masm),
|
||||
deoptLabel_(NULL)
|
||||
: CodeGeneratorShared(gen, graph, masm)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,17 +38,13 @@ CodeGeneratorX86Shared::generatePrologue()
|
||||
// Note that this automatically sets MacroAssembler::framePushed().
|
||||
masm.reserveStack(frameSize());
|
||||
|
||||
// Allocate returnLabel_ on the heap, so we don't run its destructor and
|
||||
// assert-not-bound in debug mode on compilation failure.
|
||||
returnLabel_ = new HeapLabel();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGeneratorX86Shared::generateEpilogue()
|
||||
{
|
||||
masm.bind(returnLabel_);
|
||||
masm.bind(&returnLabel_);
|
||||
|
||||
// Pop the stack we allocated at the start of the function.
|
||||
masm.freeStack(frameSize());
|
||||
@ -228,9 +223,9 @@ CodeGeneratorX86Shared::generateOutOfLineCode()
|
||||
if (!CodeGeneratorShared::generateOutOfLineCode())
|
||||
return false;
|
||||
|
||||
if (deoptLabel_) {
|
||||
if (deoptLabel_.used()) {
|
||||
// All non-table-based bailouts will go here.
|
||||
masm.bind(deoptLabel_);
|
||||
masm.bind(&deoptLabel_);
|
||||
|
||||
// Push the frame size, so the handler can recover the IonScript.
|
||||
masm.push(Imm32(frameSize()));
|
||||
@ -349,11 +344,8 @@ CodeGeneratorX86Shared::bailout(LSnapshot *snapshot)
|
||||
bool
|
||||
CodeGeneratorX86Shared::visitOutOfLineBailout(OutOfLineBailout *ool)
|
||||
{
|
||||
if (!deoptLabel_)
|
||||
deoptLabel_ = new HeapLabel();
|
||||
|
||||
masm.push(Imm32(ool->snapshot()->snapshotOffset()));
|
||||
masm.jmp(deoptLabel_);
|
||||
masm.jmp(&deoptLabel_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared
|
||||
|
||||
protected:
|
||||
// Label for the common return path.
|
||||
HeapLabel *returnLabel_;
|
||||
HeapLabel *deoptLabel_;
|
||||
NonAssertingLabel returnLabel_;
|
||||
NonAssertingLabel deoptLabel_;
|
||||
|
||||
inline Operand ToOperand(const LAllocation &a) {
|
||||
if (a.isGeneralReg())
|
||||
|
Loading…
Reference in New Issue
Block a user