 Chromium Code Reviews
 Chromium Code Reviews Issue 609843002:
  Refactor FrameAndConstantPoolScope and ConstantPoolUnavailableScope to be architecture independent  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 609843002:
  Refactor FrameAndConstantPoolScope and ConstantPoolUnavailableScope to be architecture independent  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/macro-assembler.h | 
| diff --git a/src/macro-assembler.h b/src/macro-assembler.h | 
| index 54cebca90f879fed0bb4e74aa737014704b6bbd4..ae2a39be4b2d78728099e324878db24fb0d848b3 100644 | 
| --- a/src/macro-assembler.h | 
| +++ b/src/macro-assembler.h | 
| @@ -93,10 +93,12 @@ namespace internal { | 
| class FrameScope { | 
| public: | 
| - explicit FrameScope(MacroAssembler* masm, StackFrame::Type type) | 
| + explicit FrameScope(MacroAssembler* masm, StackFrame::Type type, | 
| + bool enter_frame = true) | 
| 
rmcilroy
2014/09/26 15:54:57
I don't like this default argument. Rethinking thi
 
baixo
2014/10/02 09:18:21
I was worried about code duplication, since this c
 | 
| : masm_(masm), type_(type), old_has_frame_(masm->has_frame()) { | 
| masm->set_has_frame(true); | 
| - if (type != StackFrame::MANUAL && type_ != StackFrame::NONE) { | 
| + if (enter_frame && type != StackFrame::MANUAL && | 
| + type_ != StackFrame::NONE) { | 
| masm->EnterFrame(type); | 
| } | 
| } | 
| @@ -118,12 +120,34 @@ class FrameScope { | 
| masm_->LeaveFrame(type_); | 
| } | 
| - private: | 
| + protected: | 
| MacroAssembler* masm_; | 
| StackFrame::Type type_; | 
| bool old_has_frame_; | 
| }; | 
| +class FrameAndConstantPoolScope : public FrameScope { | 
| + public: | 
| + FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) | 
| + : FrameScope(masm, type, false), | 
| + old_constant_pool_available_(masm->is_constant_pool_available()) { | 
| + // We only want to enable constant pool access for non-manual frame scopes | 
| + // to ensure the constant pool pointer is valid throughout the scope. | 
| + DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); | 
| + masm->set_constant_pool_available(true); | 
| + masm->EnterFrame(type, !old_constant_pool_available_); | 
| + } | 
| + | 
| + ~FrameAndConstantPoolScope() { | 
| + masm_->set_constant_pool_available(old_constant_pool_available_); | 
| + } | 
| + | 
| + private: | 
| + bool old_constant_pool_available_; | 
| + | 
| + DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); | 
| +}; | 
| + | 
| class AllowExternalCallThatCantCauseGC: public FrameScope { | 
| public: |