Bug 1393011 - Part 1: Rename skipPool() to maybeSkipAutomaticInstructions(). r=bbouvier

The greater verbosity more accurately describes skipPool()'s behavior.
This commit is contained in:
Sean Stangl 2017-12-13 15:55:11 -06:00
Родитель 8a5c331fd2
Коммит d3722cb0b4
3 изменённых файлов: 31 добавлений и 25 удалений

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

@ -3263,7 +3263,7 @@ InstIsArtificialGuard(Instruction* inst, const PoolHeader** ph)
// If the instruction points to a artificial pool guard then skip the pool.
Instruction*
Instruction::skipPool()
Instruction::maybeSkipAutomaticInstructions()
{
const PoolHeader* ph;
// If this is a guard, and the next instruction is a header, always work
@ -3272,15 +3272,15 @@ Instruction::skipPool()
// Don't skip a natural guard.
if (ph->isNatural())
return this;
return (this + 1 + ph->size())->skipPool();
return (this + 1 + ph->size())->maybeSkipAutomaticInstructions();
}
if (InstIsBNop(this))
return (this + 1)->skipPool();
return (this + 1)->maybeSkipAutomaticInstructions();
return this;
}
void
BufferInstructionIterator::skipPool()
BufferInstructionIterator::maybeSkipAutomaticInstructions()
{
// If this is a guard, and the next instruction is a header, always work
// around the pool. If it isn't a guard, then start looking ahead.
@ -3291,13 +3291,13 @@ BufferInstructionIterator::skipPool()
if (ph->isNatural())
return;
advance(sizeof(Instruction) * (1 + ph->size()));
skipPool();
maybeSkipAutomaticInstructions();
return;
}
if (InstIsBNop(cur())) {
next();
skipPool();
maybeSkipAutomaticInstructions();
}
}
@ -3340,10 +3340,10 @@ Instruction::next()
// If this is a guard, and the next instruction is a header, always work
// around the pool. If it isn't a guard, then start looking ahead.
if (InstIsGuard(this, &ph))
return (ret + ph->size())->skipPool();
return (ret + ph->size())->maybeSkipAutomaticInstructions();
if (InstIsArtificialGuard(ret, &ph))
return (ret + 1 + ph->size())->skipPool();
return ret->skipPool();
return (ret + 1 + ph->size())->maybeSkipAutomaticInstructions();
return ret->maybeSkipAutomaticInstructions();
}
void
@ -3387,8 +3387,7 @@ void
Assembler::ToggleCall(CodeLocationLabel inst_, bool enabled)
{
Instruction* inst = (Instruction*)inst_.raw();
// Skip a pool with an artificial guard.
inst = inst->skipPool();
inst = inst->maybeSkipAutomaticInstructions();
MOZ_ASSERT(inst->is<InstMovW>() || inst->is<InstLDR>());
if (inst->is<InstMovW>()) {
@ -3418,8 +3417,7 @@ size_t
Assembler::ToggledCallSize(uint8_t* code)
{
Instruction* inst = (Instruction*)code;
// Skip a pool with an artificial guard.
inst = inst->skipPool();
inst = inst->maybeSkipAutomaticInstructions();
MOZ_ASSERT(inst->is<InstMovW>() || inst->is<InstLDR>());
if (inst->is<InstMovW>()) {
@ -3439,7 +3437,7 @@ Assembler::BailoutTableStart(uint8_t* code)
{
Instruction* inst = (Instruction*)code;
// Skip a pool with an artificial guard or NOP fill.
inst = inst->skipPool();
inst = inst->maybeSkipAutomaticInstructions();
MOZ_ASSERT(inst->is<InstBLImm>());
return (uint8_t*) inst;
}

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

@ -2006,12 +2006,14 @@ class Instruction
MOZ_ASSERT(data >> 28 != 0xf, "The instruction does not have condition code");
return (Assembler::Condition)(data & 0xf0000000);
}
// Get the next instruction in the instruction stream.
// This does neat things like ignoreconstant pools and their guards.
// Get the next intentionally-placed instruction in the instruction stream.
// Artificial pool guards and automatically-placed NOP instructions are skipped.
Instruction* next();
// Skipping pools with artificial guards.
Instruction* skipPool();
// If the current instruction was automatically-inserted (pool guards and NOPs),
// advance to the next instruction that was inserted intentionally.
Instruction* maybeSkipAutomaticInstructions();
// Sometimes, an api wants a uint32_t (or a pointer to it) rather than an
// instruction. raw() just coerces this into a pointer to a uint32_t.
@ -2266,17 +2268,23 @@ class InstructionIterator
{
private:
Instruction* inst_;
public:
explicit InstructionIterator(Instruction* inst) : inst_(inst) {
skipPool();
explicit InstructionIterator(Instruction* inst)
: inst_(inst)
{
maybeSkipAutomaticInstructions();
}
void skipPool() {
inst_ = inst_->skipPool();
void maybeSkipAutomaticInstructions() {
inst_ = inst_->maybeSkipAutomaticInstructions();
}
Instruction* next() {
inst_ = inst_->next();
return cur();
return inst_;
}
Instruction* cur() const {
return inst_;
}
@ -2288,7 +2296,7 @@ class BufferInstructionIterator : public ARMBuffer::AssemblerBufferInstIterator
BufferInstructionIterator(BufferOffset bo, ARMBuffer* buffer)
: ARMBuffer::AssemblerBufferInstIterator(bo, buffer)
{}
void skipPool();
void maybeSkipAutomaticInstructions();
};
static const uint32_t NumIntArgRegs = 4;

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

@ -357,7 +357,7 @@ MacroAssemblerARM::ma_mov_patch(Imm32 imm32, Register dest, Assembler::Condition
// Make sure the current instruction is not an artificial guard inserted
// by the assembler buffer.
iter.skipPool();
iter.maybeSkipAutomaticInstructions();
int32_t imm = imm32.value;
switch(rs) {