Bug 1228369: Rename CodeOffset::use/used into bind/bound; r=luke
authorBenjamin Bouvier <benj@benj.me>
Thu, 26 Nov 2015 17:54:01 +0100
changeset 308874 8e82466eab91ecab76ed5c7edf5b47788eb29b70
parent 308873 630fb403d6703b373cd3966ede1753ff6a118205
child 308875 c2cefe6f9f0a0218a159cefb1880ebaf88fb0f1c
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1228369
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1228369: Rename CodeOffset::use/used into bind/bound; r=luke
js/src/jit/BaselineCompiler.cpp
js/src/jit/MacroAssembler-inl.h
js/src/jit/arm/Assembler-arm.cpp
js/src/jit/arm/CodeGenerator-arm.cpp
js/src/jit/shared/Assembler-shared.h
js/src/jit/x64/Assembler-x64.h
js/src/jit/x86-shared/Assembler-x86-shared.h
js/src/jit/x86-shared/CodeGenerator-x86-shared.cpp
js/src/jit/x86/Assembler-x86.h
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -886,32 +886,32 @@ BaselineCompiler::emitProfilerEnterFrame
     // Store stack position to lastProfilingFrame variable, guarded by a toggled jump.
     // Starts off initially disabled.
     Label noInstrument;
     CodeOffset toggleOffset = masm.toggledJump(&noInstrument);
     masm.profilerEnterFrame(masm.getStackPointer(), R0.scratchReg());
     masm.bind(&noInstrument);
 
     // Store the start offset in the appropriate location.
-    MOZ_ASSERT(!profilerEnterFrameToggleOffset_.used());
+    MOZ_ASSERT(!profilerEnterFrameToggleOffset_.bound());
     profilerEnterFrameToggleOffset_ = toggleOffset;
 }
 
 void
 BaselineCompiler::emitProfilerExitFrame()
 {
     // Store previous frame to lastProfilingFrame variable, guarded by a toggled jump.
     // Starts off initially disabled.
     Label noInstrument;
     CodeOffset toggleOffset = masm.toggledJump(&noInstrument);
     masm.profilerExitFrame();
     masm.bind(&noInstrument);
 
     // Store the start offset in the appropriate location.
-    MOZ_ASSERT(!profilerExitFrameToggleOffset_.used());
+    MOZ_ASSERT(!profilerExitFrameToggleOffset_.bound());
     profilerExitFrameToggleOffset_ = toggleOffset;
 }
 
 MethodStatus
 BaselineCompiler::emitBody()
 {
     MOZ_ASSERT(pc == script->code());
 
--- a/js/src/jit/MacroAssembler-inl.h
+++ b/js/src/jit/MacroAssembler-inl.h
@@ -305,17 +305,17 @@ void
 MacroAssembler::leaveExitFrame(size_t extraFrame)
 {
     freeStack(ExitFooterFrame::Size() + extraFrame);
 }
 
 bool
 MacroAssembler::hasSelfReference() const
 {
-    return selfReferencePatch_.used();
+    return selfReferencePatch_.bound();
 }
 
 //}}} check_macroassembler_style
 // ===============================================================
 
 void
 MacroAssembler::branchFunctionKind(Condition cond, JSFunction::FunctionKind kind, Register fun,
                                    Register scratch, Label* label)
--- a/js/src/jit/arm/Assembler-arm.cpp
+++ b/js/src/jit/arm/Assembler-arm.cpp
@@ -948,17 +948,17 @@ Assembler::processCodeLabels(uint8_t* ra
         CodeLabel label = codeLabels_[i];
         Bind(rawCode, label.patchAt(), rawCode + label.target()->offset());
     }
 }
 
 void
 Assembler::writeCodePointer(CodeOffset* label) {
     BufferOffset off = writeInst(LabelBase::INVALID_OFFSET);
-    label->use(off.getOffset());
+    label->bind(off.getOffset());
 }
 
 void
 Assembler::Bind(uint8_t* rawCode, CodeOffset* label, const void* address)
 {
     *reinterpret_cast<const void**>(rawCode + label->offset()) = address;
 }
 
--- a/js/src/jit/arm/CodeGenerator-arm.cpp
+++ b/js/src/jit/arm/CodeGenerator-arm.cpp
@@ -1026,17 +1026,17 @@ CodeGeneratorARM::visitOutOfLineTableSwi
     for (size_t i = 0; i < numCases; i++) {
         LBlock* caseblock = skipTrivialBlocks(mir->getCase(numCases - 1 - i))->lir();
         Label* caseheader = caseblock->label();
         uint32_t caseoffset = caseheader->offset();
 
         // 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);
     }
 }
 
 void
 CodeGeneratorARM::emitTableSwitchDispatch(MTableSwitch* mir, Register index, Register base)
 {
     // The code generated by this is utter hax.
--- a/js/src/jit/shared/Assembler-shared.h
+++ b/js/src/jit/shared/Assembler-shared.h
@@ -421,38 +421,38 @@ struct AbsoluteLabel : public LabelBase
         offset_ = -1;
     }
 };
 
 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;
     }
 };
 
 // A code label contains an absolute reference to a point in the code. Thus, it
 // cannot be patched until after linking.
 // When the source label is resolved into a memory address, this address is
--- a/js/src/jit/x64/Assembler-x64.h
+++ b/js/src/jit/x64/Assembler-x64.h
@@ -609,17 +609,17 @@ class Assembler : public AssemblerX86Sha
     void mov(Imm32 imm32, const Operand& dest) {
         movq(imm32, dest);
     }
     void mov(Register src, Register dest) {
         movq(src, dest);
     }
     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);
     }
     void lea(const Operand& src, Register dest) {
         switch (src.kind()) {
           case Operand::MEM_REG_DISP:
             masm.leaq_mr(src.disp(), src.base(), dest.encoding());
--- a/js/src/jit/x86-shared/Assembler-x86-shared.h
+++ b/js/src/jit/x86-shared/Assembler-x86-shared.h
@@ -436,17 +436,17 @@ class AssemblerX86Shared : public Assemb
         masm.haltingAlign(alignment);
     }
     void nopAlign(int alignment) {
         masm.nopAlign(alignment);
     }
     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());
     }
     void movl(Register src, Register dest) {
         masm.movl_rr(src.encoding(), dest.encoding());
     }
     void movl(const Operand& src, Register dest) {
@@ -919,17 +919,17 @@ class AssemblerX86Shared : public Assemb
         JmpDst dst(masm.label());
         if (label->used()) {
             JmpSrc jmp(label->offset());
             masm.linkJump(jmp, dst);
         }
         label->bind(dst.offset());
     }
     void use(CodeOffset* label) {
-        label->use(currentOffset());
+        label->bind(currentOffset());
     }
     uint32_t currentOffset() {
         return masm.label().offset();
     }
 
     // Re-routes pending jumps to a new label.
     void retargetWithOffset(size_t baseOffset, const LabelBase* label, LabelBase* target) {
         if (!label->used())
@@ -951,17 +951,17 @@ class AssemblerX86Shared : public Assemb
         } while (more);
     }
     void retarget(Label* label, Label* target) {
         retargetWithOffset(0, label, target);
         label->reset();
     }
 
     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);
         }
     }
 
     // See Bind and X86Encoding::setPointer.
     size_t labelToPatchOffset(CodeOffset label) {
         return label.offset() - sizeof(void*);
--- a/js/src/jit/x86-shared/CodeGenerator-x86-shared.cpp
+++ b/js/src/jit/x86-shared/CodeGenerator-x86-shared.cpp
@@ -1626,17 +1626,17 @@ CodeGeneratorX86Shared::visitOutOfLineTa
         LBlock* caseblock = skipTrivialBlocks(mir->getCase(i))->lir();
         Label* caseheader = caseblock->label();
         uint32_t caseoffset = caseheader->offset();
 
         // The entries of the jump table need to be absolute addresses and thus
         // must be patched after codegen is finished.
         CodeLabel cl;
         masm.writeCodePointer(cl.patchAt());
-        cl.target()->use(caseoffset);
+        cl.target()->bind(caseoffset);
         masm.addCodeLabel(cl);
     }
 }
 
 void
 CodeGeneratorX86Shared::emitTableSwitchDispatch(MTableSwitch* mir, Register index, Register base)
 {
     Label* defaultcase = skipTrivialBlocks(mir->getDefault())->lir()->label();
--- a/js/src/jit/x86/Assembler-x86.h
+++ b/js/src/jit/x86/Assembler-x86.h
@@ -297,17 +297,17 @@ class Assembler : public AssemblerX86Sha
         movl(src, dest);
     }
     void mov(Imm32 imm, const Operand& dest) {
         movl(imm, dest);
     }
     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);
     }
     void xchg(Register src, Register dest) {
         xchgl(src, dest);
     }
     void lea(const Operand& src, Register dest) {