Commit f096405a authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[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/+/3576131Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79877}
parent 1deba1a2
...@@ -251,12 +251,6 @@ struct Use { ...@@ -251,12 +251,6 @@ struct Use {
(void)unused_tmp_array_for_use_macro; \ (void)unused_tmp_array_for_use_macro; \
} while (false) } 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 base
} // namespace v8 } // namespace v8
......
...@@ -316,7 +316,7 @@ void BaselineAssembler::PushReverse(T... vals) { ...@@ -316,7 +316,7 @@ void BaselineAssembler::PushReverse(T... vals) {
template <typename... T> template <typename... T>
void BaselineAssembler::Pop(T... registers) { void BaselineAssembler::Pop(T... registers) {
ITERATE_PACK(__ Pop(registers)); (__ Pop(registers), ...);
} }
void BaselineAssembler::LoadTaggedPointerField(Register output, Register source, void BaselineAssembler::LoadTaggedPointerField(Register output, Register source,
......
...@@ -323,7 +323,7 @@ void BaselineAssembler::PushReverse(T... vals) { ...@@ -323,7 +323,7 @@ void BaselineAssembler::PushReverse(T... vals) {
template <typename... T> template <typename... T>
void BaselineAssembler::Pop(T... registers) { void BaselineAssembler::Pop(T... registers) {
ITERATE_PACK(__ Pop(registers)); (__ Pop(registers), ...);
} }
void BaselineAssembler::LoadTaggedPointerField(Register output, Register source, void BaselineAssembler::LoadTaggedPointerField(Register output, Register source,
......
...@@ -212,9 +212,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness, ...@@ -212,9 +212,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness,
if (BytecodeOperands::WritesAccumulator(implicit_register_use)) { if (BytecodeOperands::WritesAccumulator(implicit_register_use)) {
in_liveness->MarkAccumulatorDead(); in_liveness->MarkAccumulatorDead();
} }
ITERATE_PACK( (UpdateInLivenessForOutOperand<bytecode, operand_types, operand_index>(
UpdateInLivenessForOutOperand<bytecode, operand_types, operand_index>( in_liveness, iterator),
in_liveness, iterator)); ...);
if (Bytecodes::WritesImplicitRegister(bytecode)) { if (Bytecodes::WritesImplicitRegister(bytecode)) {
in_liveness->MarkRegisterDead(Register::FromShortStar(bytecode).index()); in_liveness->MarkRegisterDead(Register::FromShortStar(bytecode).index());
...@@ -223,9 +223,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness, ...@@ -223,9 +223,9 @@ void UpdateInLiveness(BytecodeLivenessState* in_liveness,
if (BytecodeOperands::ReadsAccumulator(implicit_register_use)) { if (BytecodeOperands::ReadsAccumulator(implicit_register_use)) {
in_liveness->MarkAccumulatorLive(); in_liveness->MarkAccumulatorLive();
} }
ITERATE_PACK( (UpdateInLivenessForInOperand<bytecode, operand_types, operand_index>(
UpdateInLivenessForInOperand<bytecode, operand_types, operand_index>( in_liveness, iterator),
in_liveness, iterator)); ...);
} }
template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use, template <Bytecode bytecode, ImplicitRegisterUse implicit_register_use,
......
...@@ -1570,7 +1570,7 @@ class CodeAssemblerParameterizedLabel ...@@ -1570,7 +1570,7 @@ class CodeAssemblerParameterizedLabel
{PhiMachineRepresentationOf<Types>...}); {PhiMachineRepresentationOf<Types>...});
auto it = phi_nodes.begin(); auto it = phi_nodes.begin();
USE(it); USE(it);
ITERATE_PACK(AssignPhi(results, *(it++))); (AssignPhi(results, *(it++)), ...);
} }
template <class T> template <class T>
static void AssignPhi(TNode<T>* result, Node* phi) { static void AssignPhi(TNode<T>* result, Node* phi) {
......
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