[base] Remove ITERATE_PACK

Replace by a unary right fold using the comma operator. This also
evaluates from left to right, so has the same semantics but uses
standard C++17 syntax.

R=tebbi@chromium.org

Bug: v8:12425
Change-Id: I680800ba07b048ee85d9da4ae32c12825df14e54
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3576131
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79877}
This commit is contained in:
Clemens Backes 2022-04-07 18:56:48 +02:00 committed by V8 LUCI CQ
parent 1deba1a29b
commit f096405a0e
5 changed files with 9 additions and 15 deletions

View File

@ -251,12 +251,6 @@ struct Use {
(void)unused_tmp_array_for_use_macro; \
} while (false)
// Evaluate the instantiations of an expression with parameter packs.
// Since USE has left-to-right evaluation order of it's arguments,
// the parameter pack is iterated from left to right and side effects
// have defined behavior.
#define ITERATE_PACK(...) USE(0, ((__VA_ARGS__), 0)...)
} // namespace base
} // namespace v8

View File

@ -316,7 +316,7 @@ void BaselineAssembler::PushReverse(T... vals) {
template <typename... T>
void BaselineAssembler::Pop(T... registers) {
ITERATE_PACK(__ Pop(registers));
(__ Pop(registers), ...);
}
void BaselineAssembler::LoadTaggedPointerField(Register output, Register source,

View File

@ -323,7 +323,7 @@ void BaselineAssembler::PushReverse(T... vals) {
template <typename... T>
void BaselineAssembler::Pop(T... registers) {
ITERATE_PACK(__ Pop(registers));
(__ Pop(registers), ...);
}
void BaselineAssembler::LoadTaggedPointerField(Register output, Register source,

View File

@ -212,9 +212,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness,
if (BytecodeOperands::WritesAccumulator(implicit_register_use)) {
in_liveness->MarkAccumulatorDead();
}
ITERATE_PACK(
UpdateInLivenessForOutOperand<bytecode, operand_types, operand_index>(
in_liveness, iterator));
(UpdateInLivenessForOutOperand<bytecode, operand_types, operand_index>(
in_liveness, iterator),
...);
if (Bytecodes::WritesImplicitRegister(bytecode)) {
in_liveness->MarkRegisterDead(Register::FromShortStar(bytecode).index());
@ -223,9 +223,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness,
if (BytecodeOperands::ReadsAccumulator(implicit_register_use)) {
in_liveness->MarkAccumulatorLive();
}
ITERATE_PACK(
UpdateInLivenessForInOperand<bytecode, operand_types, operand_index>(
in_liveness, iterator));
(UpdateInLivenessForInOperand<bytecode, operand_types, operand_index>(
in_liveness, iterator),
...);
}
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use,

View File

@ -1570,7 +1570,7 @@ class CodeAssemblerParameterizedLabel
{PhiMachineRepresentationOf<Types>...});
auto it = phi_nodes.begin();
USE(it);
ITERATE_PACK(AssignPhi(results, *(it++)));
(AssignPhi(results, *(it++)), ...);
}
template <class T>
static void AssignPhi(TNode<T>* result, Node* phi) {