Index: src/a64/macro-assembler-a64.h |
diff --git a/src/a64/macro-assembler-a64.h b/src/a64/macro-assembler-a64.h |
index 7b8dd3f806734d3f4dfed8b984998b39da58b402..59fa9131cbd70b619a0a1cfc847c3bf8ad1ba050 100644 |
--- a/src/a64/macro-assembler-a64.h |
+++ b/src/a64/macro-assembler-a64.h |
@@ -28,6 +28,8 @@ |
#ifndef V8_A64_MACRO_ASSEMBLER_A64_H_ |
#define V8_A64_MACRO_ASSEMBLER_A64_H_ |
+#include <vector> |
+ |
#include "v8globals.h" |
#include "globals.h" |
@@ -516,7 +518,8 @@ class MacroAssembler : public Assembler { |
} |
// Push the specified register 'count' times. |
- void PushMultipleTimes(int count, Register src); |
+ void PushMultipleTimes(CPURegister src, Register count); |
+ void PushMultipleTimes(CPURegister src, int count); |
// This is a convenience method for pushing a single Handle<Object>. |
inline void Push(Handle<Object> handle); |
@@ -530,6 +533,35 @@ class MacroAssembler : public Assembler { |
Pop(dst); |
} |
+ // Sometimes callers need to push or pop multiple registers in a way that is |
+ // difficult to structure efficiently for fixed Push or Pop calls. This scope |
+ // allows push requests to be queued up, then flushed at once. The |
+ // MacroAssembler will try to generate the most efficient sequence required. |
+ // |
+ // Unlike the other Push and Pop macros, PushPopQueue can handle mixed sets of |
+ // register sizes and types. |
+ class PushPopQueue { |
+ public: |
+ explicit PushPopQueue(MacroAssembler* masm) : masm_(masm), size_(0) { } |
+ |
+ ~PushPopQueue() { |
+ ASSERT(queued_.empty()); |
+ } |
+ |
+ void Queue(const CPURegister& rt) { |
+ size_ += rt.SizeInBytes(); |
+ queued_.push_back(rt); |
+ } |
+ |
+ void PushQueued(); |
+ void PopQueued(); |
+ |
+ private: |
+ MacroAssembler* masm_; |
+ int size_; |
+ std::vector<CPURegister> queued_; |
+ }; |
+ |
// Poke 'src' onto the stack. The offset is in bytes. |
// |
// If the current stack pointer (according to StackPointer()) is csp, then |
@@ -2002,9 +2034,12 @@ class MacroAssembler : public Assembler { |
// Perform necessary maintenance operations before a push or pop. |
// |
- // Note that size is per register, and is specified in bytes. |
- void PrepareForPush(int count, int size); |
- void PrepareForPop(int count, int size); |
+ // Note that size is specified in bytes. |
+ void PrepareForPush(Operand total_size); |
+ void PrepareForPop(Operand total_size); |
+ |
+ void PrepareForPush(int count, int size) { PrepareForPush(count * size); } |
+ void PrepareForPop(int count, int size) { PrepareForPop(count * size); } |
// Call Printf. On a native build, a simple call will be generated, but if the |
// simulator is being used then a suitable pseudo-instruction is used. The |