| Index: src/macro-assembler.h
 | 
| ===================================================================
 | 
| --- src/macro-assembler.h	(revision 9277)
 | 
| +++ src/macro-assembler.h	(working copy)
 | 
| @@ -93,6 +93,63 @@
 | 
|  namespace v8 {
 | 
|  namespace internal {
 | 
|  
 | 
| +class FrameScope {
 | 
| + public:
 | 
| +  explicit FrameScope(MacroAssembler* masm, StackFrame::Type type)
 | 
| +      : masm_(masm), type_(type) {
 | 
| +    ASSERT(!masm->has_frame());
 | 
| +    masm->set_has_frame(true);
 | 
| +    if (type != StackFrame::MANUAL && type_ != StackFrame::NONE) {
 | 
| +      masm->EnterFrame(type);
 | 
| +    }
 | 
| +  }
 | 
| +
 | 
| +  ~FrameScope() {
 | 
| +    if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) {
 | 
| +      masm_->LeaveFrame(type_);
 | 
| +    }
 | 
| +    masm_->set_has_frame(false);
 | 
| +  }
 | 
| +
 | 
| +  // 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() {
 | 
| +    masm_->LeaveFrame(type_);
 | 
| +  }
 | 
| +
 | 
| + private:
 | 
| +  MacroAssembler* masm_;
 | 
| +  StackFrame::Type type_;
 | 
| +};
 | 
| +
 | 
| +
 | 
| +class AllowExternalCallThatCantCauseGC: public FrameScope {
 | 
| + public:
 | 
| +  explicit AllowExternalCallThatCantCauseGC(MacroAssembler* masm)
 | 
| +      : FrameScope(masm, StackFrame::NONE) { }
 | 
| +};
 | 
| +
 | 
| +
 | 
| +class NoCurrentFrameScope {
 | 
| + public:
 | 
| +  explicit NoCurrentFrameScope(MacroAssembler* masm)
 | 
| +      : masm_(masm), saved_(masm->has_frame()) {
 | 
| +    masm->set_has_frame(false);
 | 
| +  }
 | 
| +
 | 
| +  ~NoCurrentFrameScope() {
 | 
| +    masm_->set_has_frame(saved_);
 | 
| +  }
 | 
| +
 | 
| + private:
 | 
| +  MacroAssembler* masm_;
 | 
| +  bool saved_;
 | 
| +};
 | 
| +
 | 
| +
 | 
|  // Support for "structured" code comments.
 | 
|  #ifdef DEBUG
 | 
|  
 | 
| 
 |