diff options
Diffstat (limited to 'deps/v8/src/macro-assembler.h')
-rw-r--r-- | deps/v8/src/macro-assembler.h | 73 |
1 files changed, 58 insertions, 15 deletions
diff --git a/deps/v8/src/macro-assembler.h b/deps/v8/src/macro-assembler.h index 30838bd761..7d4bbbc0ca 100644 --- a/deps/v8/src/macro-assembler.h +++ b/deps/v8/src/macro-assembler.h @@ -1,4 +1,4 @@ -// Copyright 2006-2008 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -36,20 +36,6 @@ enum InvokeFlag { }; -enum CodeLocation { - IN_JAVASCRIPT, - IN_JS_ENTRY, - IN_C_ENTRY -}; - - -enum HandlerType { - TRY_CATCH_HANDLER, - TRY_FINALLY_HANDLER, - JS_ENTRY_HANDLER -}; - - // Types of uncatchable exceptions. enum UncatchableExceptionType { OUT_OF_MEMORY, @@ -93,6 +79,63 @@ const int kInvalidProtoDepth = -1; namespace v8 { namespace internal { +class FrameScope { + public: + explicit FrameScope(MacroAssembler* masm, StackFrame::Type type) + : masm_(masm), type_(type), old_has_frame_(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(old_has_frame_); + } + + // 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_; + bool old_has_frame_; +}; + + +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 |