Bug 1228369: Rename CodeOffset::use/used into bind/bound; r=luke

This commit is contained in:
Benjamin Bouvier 2015-11-26 17:54:01 +01:00
parent 9d22d2a3f7
commit 1684cdbb43
9 changed files with 20 additions and 20 deletions

View File

@ -891,7 +891,7 @@ BaselineCompiler::emitProfilerEnterFrame()
masm.bind(&noInstrument);
// Store the start offset in the appropriate location.
MOZ_ASSERT(!profilerEnterFrameToggleOffset_.used());
MOZ_ASSERT(!profilerEnterFrameToggleOffset_.bound());
profilerEnterFrameToggleOffset_ = toggleOffset;
}
@ -906,7 +906,7 @@ BaselineCompiler::emitProfilerExitFrame()
masm.bind(&noInstrument);
// Store the start offset in the appropriate location.
MOZ_ASSERT(!profilerExitFrameToggleOffset_.used());
MOZ_ASSERT(!profilerExitFrameToggleOffset_.bound());
profilerExitFrameToggleOffset_ = toggleOffset;
}

View File

@ -310,7 +310,7 @@ MacroAssembler::leaveExitFrame(size_t extraFrame)
bool
MacroAssembler::hasSelfReference() const
{
return selfReferencePatch_.used();
return selfReferencePatch_.bound();
}
//}}} check_macroassembler_style

View File

@ -953,7 +953,7 @@ Assembler::processCodeLabels(uint8_t* rawCode)
void
Assembler::writeCodePointer(CodeOffset* label) {
BufferOffset off = writeInst(LabelBase::INVALID_OFFSET);
label->use(off.getOffset());
label->bind(off.getOffset());
}
void

View File

@ -1031,7 +1031,7 @@ CodeGeneratorARM::visitOutOfLineTableSwitch(OutOfLineTableSwitch* ool)
// The entries of the jump table need to be absolute addresses and thus
// must be patched after codegen is finished.
CodeLabel cl = ool->codeLabel(i);
cl.target()->use(caseoffset);
cl.target()->bind(caseoffset);
masm.addCodeLabel(cl);
}
}

View File

@ -426,28 +426,28 @@ class CodeOffset
{
size_t offset_;
static const size_t NOT_USED = size_t(-1);
static const size_t NOT_BOUND = size_t(-1);
public:
explicit CodeOffset(size_t offset) : offset_(offset) {}
CodeOffset() : offset_(NOT_USED) {}
CodeOffset() : offset_(NOT_BOUND) {}
size_t offset() const {
MOZ_ASSERT(used());
MOZ_ASSERT(bound());
return offset_;
}
void use(size_t offset) {
MOZ_ASSERT(!used());
void bind(size_t offset) {
MOZ_ASSERT(!bound());
offset_ = offset;
MOZ_ASSERT(used());
MOZ_ASSERT(bound());
}
bool used() const {
return offset_ != NOT_USED;
bool bound() const {
return offset_ != NOT_BOUND;
}
void offsetBy(size_t delta) {
MOZ_ASSERT(used());
MOZ_ASSERT(bound());
MOZ_ASSERT(offset_ + delta >= offset_, "no overflow");
offset_ += delta;
}

View File

@ -614,7 +614,7 @@ class Assembler : public AssemblerX86Shared
}
void mov(CodeOffset* label, Register dest) {
masm.movq_i64r(/* placeholder */ 0, dest.encoding());
label->use(masm.size());
label->bind(masm.size());
}
void xchg(Register src, Register dest) {
xchgq(src, dest);

View File

@ -441,7 +441,7 @@ class AssemblerX86Shared : public AssemblerShared
void writeCodePointer(CodeOffset* label) {
// A CodeOffset only has one use, bake in the "end of list" value.
masm.jumpTablePointer(LabelBase::INVALID_OFFSET);
label->use(masm.size());
label->bind(masm.size());
}
void movl(Imm32 imm32, Register dest) {
masm.movl_i32r(imm32.value, dest.encoding());
@ -924,7 +924,7 @@ class AssemblerX86Shared : public AssemblerShared
label->bind(dst.offset());
}
void use(CodeOffset* label) {
label->use(currentOffset());
label->bind(currentOffset());
}
uint32_t currentOffset() {
return masm.label().offset();
@ -956,7 +956,7 @@ class AssemblerX86Shared : public AssemblerShared
}
static void Bind(uint8_t* raw, CodeOffset* label, const void* address) {
if (label->used()) {
if (label->bound()) {
intptr_t offset = label->offset();
X86Encoding::SetPointer(raw + offset, address);
}

View File

@ -1631,7 +1631,7 @@ CodeGeneratorX86Shared::visitOutOfLineTableSwitch(OutOfLineTableSwitch* ool)
// must be patched after codegen is finished.
CodeLabel cl;
masm.writeCodePointer(cl.patchAt());
cl.target()->use(caseoffset);
cl.target()->bind(caseoffset);
masm.addCodeLabel(cl);
}
}

View File

@ -302,7 +302,7 @@ class Assembler : public AssemblerX86Shared
void mov(CodeOffset* label, Register dest) {
// Put a placeholder value in the instruction stream.
masm.movl_i32r(0, dest.encoding());
label->use(masm.size());
label->bind(masm.size());
}
void mov(Register src, Register dest) {
movl(src, dest);