Index: src/arm/macro-assembler-arm.h |
diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h |
index f98f14105f29be9ab1d37bc621c3eb816c29a0db..cba52638ce96c36f78f98709111028c5d52dc15b 100644 |
--- a/src/arm/macro-assembler-arm.h |
+++ b/src/arm/macro-assembler-arm.h |
@@ -540,9 +540,6 @@ class MacroAssembler: public Assembler { |
// Generates function and stub prologue code. |
void Prologue(PrologueFrameMode frame_mode); |
- // Loads the constant pool pointer (pp) register. |
- void LoadConstantPoolPointerRegister(); |
- |
// Enter exit frame. |
// stack_space - extra stack space, used for alignment before call to C. |
void EnterExitFrame(bool save_doubles, int stack_space = 0); |
@@ -1387,7 +1384,7 @@ class MacroAssembler: public Assembler { |
} |
// Activation support. |
- void EnterFrame(StackFrame::Type type); |
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool = false); |
// Returns the pc offset at which the frame ends. |
int LeaveFrame(StackFrame::Type type); |
@@ -1464,6 +1461,9 @@ class MacroAssembler: public Assembler { |
MemOperand SafepointRegisterSlot(Register reg); |
MemOperand SafepointRegistersAndDoublesSlot(Register reg); |
+ // Loads the constant pool pointer (pp) register. |
+ void LoadConstantPoolPointerRegister(); |
+ |
bool generating_stub_; |
bool has_frame_; |
// This handle will be patched with the code object on installation. |
@@ -1513,6 +1513,70 @@ class CodePatcher { |
}; |
+class FrameAndConstantPoolScope { |
+ public: |
+ FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) |
+ : masm_(masm), |
+ type_(type), |
+ old_has_frame_(masm->has_frame()), |
+ old_constant_pool_available_(masm->is_constant_pool_available()) { |
+ masm->set_has_frame(true); |
+ masm->set_constant_pool_available(true); |
+ if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) { |
+ masm->EnterFrame(type, !old_constant_pool_available_); |
+ } |
+ } |
+ |
+ ~FrameAndConstantPoolScope() { |
+ masm_->LeaveFrame(type_); |
+ masm_->set_has_frame(old_has_frame_); |
+ masm_->set_constant_pool_available(old_constant_pool_available_); |
+ } |
+ |
+ // Normally we generate the leave-frame code when this object goes |
+ // out of scope. Sometimes we may need to generate the code somewhere else |
+ // in addition. Calling this will achieve that, but the object stays in |
+ // scope, the MacroAssembler is still marked as being in a frame scope, and |
+ // the code will be generated again when it goes out of scope. |
+ void GenerateLeaveFrame() { |
+ ASSERT(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); |
+ masm_->LeaveFrame(type_); |
+ } |
+ |
+ private: |
+ MacroAssembler* masm_; |
+ StackFrame::Type type_; |
+ bool old_has_frame_; |
+ bool old_constant_pool_available_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); |
+}; |
+ |
+ |
+// Class for scoping the the unavailability of constant pool access. |
+class ConstantPoolUnavailableScope { |
+ public: |
+ explicit ConstantPoolUnavailableScope(MacroAssembler* masm) |
+ : masm_(masm), |
+ old_constant_pool_available_(masm->is_constant_pool_available()) { |
+ if (FLAG_enable_ool_constant_pool) { |
+ masm_->set_constant_pool_available(false); |
+ } |
+ } |
+ ~ConstantPoolUnavailableScope() { |
+ if (FLAG_enable_ool_constant_pool) { |
+ masm_->set_constant_pool_available(old_constant_pool_available_); |
+ } |
+ } |
+ |
+ private: |
+ MacroAssembler* masm_; |
+ int old_constant_pool_available_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); |
+}; |
+ |
+ |
// ----------------------------------------------------------------------------- |
// Static helper functions. |