| Index: src/a64/macro-assembler-a64.cc
|
| diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc
|
| index 3d2d24e9e9277c2be15b3099de9e7cdca94e53df..28b56dd47417b988c67ef3f0837a9f787ffe8b61 100644
|
| --- a/src/a64/macro-assembler-a64.cc
|
| +++ b/src/a64/macro-assembler-a64.cc
|
| @@ -672,10 +672,19 @@ void MacroAssembler::PopCPURegList(CPURegList registers) {
|
| void MacroAssembler::PushMultipleTimes(int count, Register src) {
|
| int size = src.SizeInBytes();
|
|
|
| - // TODO(all): Use a loop when optimizing for size.
|
| - TODO_UNIMPLEMENTED("PushMultipleTimes: Support --optimize-for-size.");
|
| -
|
| PrepareForPush(count, size);
|
| +
|
| + if (FLAG_optimize_for_size && count > 8) {
|
| + Label loop;
|
| + __ Mov(Tmp0(), count / 2);
|
| + __ Bind(&loop);
|
| + PushHelper(2, size, src, src, NoReg, NoReg);
|
| + __ Subs(Tmp0(), Tmp0(), 1);
|
| + __ B(ne, &loop);
|
| +
|
| + count %= 2;
|
| + }
|
| +
|
| // Push up to four registers at a time if possible because if the current
|
| // stack pointer is csp and the register size is 32, registers must be pushed
|
| // in blocks of four in order to maintain the 16-byte alignment for csp.
|
|
|