Commit 4c62ed10 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[regexp] Fix --trace-regexp-macro-assembler

.. which was previously broken due to 1. a hardcoded impl names list
and 2. the addition of a new impl (riscv).

The new solution prevents this in the future by basing both enum and
name generation on a macro list.

Bug: v8:11572
Change-Id: Ieb2134c9ecf3729633b76e4a30e7ddceba396328
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2764752
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73455}
parent c85b7a44
......@@ -13,11 +13,8 @@ namespace internal {
RegExpMacroAssemblerTracer::RegExpMacroAssemblerTracer(
Isolate* isolate, RegExpMacroAssembler* assembler)
: RegExpMacroAssembler(isolate, assembler->zone()), assembler_(assembler) {
IrregexpImplementation type = assembler->Implementation();
DCHECK_LT(type, 9);
const char* impl_names[] = {"IA32", "ARM", "ARM64", "MIPS", "S390",
"PPC", "X64", "X87", "Bytecode"};
PrintF("RegExpMacroAssembler%s();\n", impl_names[type]);
PrintF("RegExpMacroAssembler%s();\n",
ImplementationToString(assembler->Implementation()));
}
RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() = default;
......
......@@ -39,18 +39,32 @@ class RegExpMacroAssembler {
static constexpr int kUseCharactersValue = -1;
#define IMPLEMENTATIONS_LIST(V) \
V(IA32) \
V(ARM) \
V(ARM64) \
V(MIPS) \
V(RISCV) \
V(S390) \
V(PPC) \
V(X64) \
V(Bytecode)
enum IrregexpImplementation {
kIA32Implementation,
kARMImplementation,
kARM64Implementation,
kMIPSImplementation,
kRISCVImplementation,
kS390Implementation,
kPPCImplementation,
kX64Implementation,
kX87Implementation,
kBytecodeImplementation
#define V(Name) k##Name##Implementation,
IMPLEMENTATIONS_LIST(V)
#undef V
};
inline const char* ImplementationToString(IrregexpImplementation impl) {
static const char* const kNames[] = {
#define V(Name) #Name,
IMPLEMENTATIONS_LIST(V)
#undef V
};
return kNames[impl];
}
#undef IMPLEMENTATIONS_LIST
enum StackCheckFlag {
kNoStackLimitCheck = false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment