Backed out changeset 5c1893bd77c2 (bug 1499323) for linting failure at /builds/worker/checkouts/gecko/config/check_macroassembler_style.py:149:5 on a CLOSED TREE

This commit is contained in:
Daniel Varga 2018-11-29 16:03:08 +02:00
parent 6570f1fb9f
commit dc295b2050
20 changed files with 59 additions and 42 deletions

View File

@ -48,8 +48,6 @@ def get_normalized_signatures(signature, fileAnnot=None):
signature = signature.replace(';', ' ')
# Normalize spaces.
signature = re.sub(r'\s+', ' ', signature).strip()
# Remove new-line induced spaces after opening braces.
signature = re.sub(r'\(\s+', '(', signature).strip()
# Match arguments, and keep only the type.
signature = reMatchArg.sub('\g<type>', signature)
# Remove class name
@ -152,57 +150,39 @@ def get_macroassembler_definitions(filename):
with open(filename) as f:
for line in f:
if '//{{{ check_macroassembler_style' in line:
if style_section:
raise 'check_macroassembler_style section already opened.'
style_section = True
braces_depth = 0
elif '//}}} check_macroassembler_style' in line:
style_section = False
if not style_section:
continue
# Remove comments from the processed line.
line = re.sub(r'//.*', '', line)
# Locate and count curly braces.
open_curly_brace = line.find('{')
was_braces_depth = braces_depth
braces_depth = braces_depth + line.count('{') - line.count('}')
# Raise an error if the check_macroassembler_style macro is used
# across namespaces / classes scopes.
if braces_depth < 0:
raise 'check_macroassembler_style annotations are not well scoped.'
# If the current line contains an opening curly brace, check if
# this line combines with the previous one can be identified as a
# MacroAssembler function signature.
if open_curly_brace != -1 and was_braces_depth == 0:
lines = lines + line[:open_curly_brace]
if line.startswith('{') or line.strip() == "{}":
if 'MacroAssembler::' in lines:
signatures.extend(
get_normalized_signatures(lines, fileAnnot))
if line.strip() != "{}": # Empty declaration, no need to declare
# a new code section
code_section = True
continue
if line.startswith('}'):
code_section = False
lines = ''
continue
# We do not aggregate any lines if we are scanning lines which are
# in-between a set of curly braces.
if braces_depth > 0:
if code_section:
continue
if was_braces_depth != 0:
line = line[line.rfind('}') + 1:]
# This logic is used to remove template instantiation, static
# variable definitions and function declaration from the next
# function definition.
last_semi_colon = line.rfind(';')
if last_semi_colon != -1:
if len(line.strip()) == 0:
lines = ''
line = line[last_semi_colon + 1:]
# Aggregate lines of non-braced text, which corresponds to the space
# where we are expecting to find function definitions.
continue
lines = lines + line
# Continue until we have a complete declaration
if '{' not in lines:
continue
# Skip variable declarations
if ')' not in lines:
lines = ''
continue
return signatures
@ -221,17 +201,14 @@ def get_macroassembler_declaration(filename):
continue
line = re.sub(r'//.*', '', line)
if len(line.strip()) == 0 or 'public:' in line or 'private:' in line:
if len(line.strip()) == 0:
lines = ''
continue
lines = lines + line
# Continue until we have a complete declaration
if ';' not in lines:
continue
# Skip member declarations: which are lines ending with a
# semi-colon without any list of arguments.
# Skip variable declarations
if ')' not in lines:
lines = ''
continue

View File

@ -33,6 +33,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@ -799,6 +800,7 @@ template void MacroAssembler::storeFloat32(FloatRegister src, const Address& des
template void MacroAssembler::storeFloat32(FloatRegister src, const BaseIndex& dest);
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
#ifndef JS_CODEGEN_ARM64

View File

@ -2954,6 +2954,7 @@ MacroAssembler::subFromStackPtr(Register reg)
}
#endif // JS_CODEGEN_ARM64
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@ -3806,6 +3807,7 @@ MacroAssembler::boundsCheck32PowerOfTwo(Register index, uint32_t length, Label*
}
//}}} check_macroassembler_style
// clang-format on
void
MacroAssembler::memoryBarrierBefore(const Synchronization& sync) {

View File

@ -350,6 +350,7 @@ class MacroAssembler : public MacroAssemblerSpecific
void Push(RegisterOrSP reg);
#endif
// clang-format off
//{{{ check_macroassembler_decl_style
public:
// ===============================================================
@ -2135,6 +2136,7 @@ class MacroAssembler : public MacroAssemblerSpecific
void speculationBarrier() PER_SHARED_ARCH;
//}}} check_macroassembler_decl_style
// clang-format on
public:
// Emits a test of a value against all types in a TypeSet. A scratch
@ -2900,6 +2902,7 @@ class IonHeapMacroAssembler : public MacroAssembler
}
};
// clang-format off
//{{{ check_macroassembler_style
inline uint32_t
MacroAssembler::framePushed() const
@ -2928,6 +2931,7 @@ MacroAssembler::implicitPop(uint32_t bytes)
adjustFrame(-int32_t(bytes));
}
//}}} check_macroassembler_style
// clang-format on
static inline Assembler::DoubleCondition
JSOpToDoubleCondition(JSOp op)

View File

@ -12,6 +12,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -2334,6 +2335,7 @@ MacroAssembler::clampIntToUint8(Register reg)
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
void

View File

@ -4362,6 +4362,7 @@ MacroAssembler::subFromStackPtr(Imm32 imm32)
}
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// MacroAssembler high-level usage.
@ -6175,6 +6176,7 @@ MacroAssembler::speculationBarrier()
}
//}}} check_macroassembler_style
// clang-format on
void
MacroAssemblerARM::wasmTruncateToInt32(FloatRegister input, Register output, MIRType fromType,

View File

@ -12,6 +12,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -1981,6 +1982,7 @@ MacroAssembler::clampIntToUint8(Register reg)
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
void

View File

@ -413,6 +413,7 @@ MacroAssembler::Push(RegisterOrSP reg)
adjustFrame(sizeof(intptr_t));
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// MacroAssembler high-level usage.
@ -2024,6 +2025,7 @@ MacroAssembler::speculationBarrier()
}
//}}} check_macroassembler_style
// clang-format off
} // namespace jit
} // namespace js

View File

@ -12,6 +12,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -1110,6 +1111,7 @@ MacroAssembler::clampIntToUint8(Register reg)
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
} // namespace jit

View File

@ -1439,6 +1439,7 @@ MacroAssemblerMIPSShared::asMasm() const
return *static_cast<const MacroAssembler*>(this);
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// MacroAssembler high-level usage.
@ -2928,3 +2929,4 @@ MacroAssembler::speculationBarrier()
MOZ_CRASH();
}
//}}} check_macroassembler_style
// clang-format on

View File

@ -14,6 +14,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -1011,6 +1012,7 @@ MacroAssembler::branchTruncateFloat32MaybeModUint32(FloatRegister src, Register
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
void

View File

@ -2109,6 +2109,7 @@ MacroAssembler::subFromStackPtr(Imm32 imm32)
}
}
// clang-format on
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@ -2967,3 +2968,4 @@ MacroAssembler::convertUInt64ToDouble(Register64 src, FloatRegister dest, Regist
}
//}}} check_macroassembler_style
// clang-format on

View File

@ -14,6 +14,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -758,6 +759,7 @@ MacroAssembler::branchTruncateFloat32MaybeModUint32(FloatRegister src, Register
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
// The specializations for cmpPtrSet are outside the braces because check_macroassembler_style can't yet

View File

@ -1948,6 +1948,7 @@ MacroAssembler::subFromStackPtr(Imm32 imm32)
}
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// Stack manipulation functions.
@ -2759,3 +2760,4 @@ MacroAssembler::convertUInt64ToFloat32(Register64 src_, FloatRegister dest, Regi
}
//}}} check_macroassembler_style
// clang-format on

View File

@ -14,6 +14,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
@ -964,6 +965,7 @@ MacroAssembler::truncateDoubleToUInt64(Address src, Address dest, Register temp,
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
void

View File

@ -303,6 +303,7 @@ MacroAssembler::subFromStackPtr(Imm32 imm32)
}
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// ABI function calls.
@ -1038,3 +1039,4 @@ MacroAssembler::wasmAtomicEffectOp64(const wasm::MemoryAccessDesc& access, Atomi
}
//}}} check_macroassembler_style
// clang-format on

View File

@ -12,6 +12,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// Move instructions
@ -1331,6 +1332,7 @@ MacroAssembler::clampIntToUint8(Register reg)
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
} // namespace jit

View File

@ -270,6 +270,7 @@ MacroAssemblerX86Shared::minMaxFloat32(FloatRegister first, FloatRegister second
bind(&done);
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// MacroAssembler high-level usage.
@ -1673,3 +1674,4 @@ MacroAssembler::speculationBarrier()
}
//}}} check_macroassembler_style
// clang-format on

View File

@ -14,6 +14,7 @@
namespace js {
namespace jit {
// clang-format off
//{{{ check_macroassembler_style
void
@ -1182,6 +1183,7 @@ MacroAssembler::truncateDoubleToUInt64(Address src, Address dest, Register temp,
}
//}}} check_macroassembler_style
// clang-format on
// ===============================================================
// Note: this function clobbers the source register.

View File

@ -302,6 +302,7 @@ MacroAssembler::subFromStackPtr(Imm32 imm32)
}
}
// clang-format off
//{{{ check_macroassembler_style
// ===============================================================
// ABI function calls.
@ -1281,4 +1282,5 @@ MacroAssembler::convertInt64ToFloat32(Register64 input, FloatRegister output)
}
//}}} check_macroassembler_style
// clang-format on