📄 frames.h.svn-base
字号:
public: virtual Type type() const { return EXIT_DEBUG; } virtual Code* FindCode() const; static ExitDebugFrame* cast(StackFrame* frame) { ASSERT(frame->is_exit_debug()); return static_cast<ExitDebugFrame*>(frame); } protected: explicit ExitDebugFrame(StackFrameIterator* iterator) : ExitFrame(iterator) { } private: friend class StackFrameIterator;};class StandardFrame: public StackFrame { public: // Testers. virtual bool is_standard() const { return true; } // Accessors. inline Object* context() const; // Access the expressions in the stack frame including locals. inline Object* GetExpression(int index) const; inline void SetExpression(int index, Object* value); int ComputeExpressionsCount() const; static StandardFrame* cast(StackFrame* frame) { ASSERT(frame->is_standard()); return static_cast<StandardFrame*>(frame); } protected: explicit StandardFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } virtual Type GetCallerState(State* state) const; // Accessors. inline Address caller_sp() const; inline Address caller_fp() const; inline Address caller_pc() const; // Computes the address of the PC field in the standard frame given // by the provided frame pointer. static inline Address ComputePCAddress(Address fp); // Iterate over expression stack including stack handlers, locals, // and parts of the fixed part including context and code fields. void IterateExpressions(ObjectVisitor* v) const; // Returns the address of the n'th expression stack element. Address GetExpressionAddress(int n) const; // Determines if the n'th expression stack element is in a stack // handler or not. Requires traversing all handlers in this frame. bool IsExpressionInsideHandler(int n) const; // Determines if the standard frame for the given frame pointer is // an arguments adaptor frame. static inline bool IsArgumentsAdaptorFrame(Address fp); // Determines if the standard frame for the given program counter is // a construct trampoline. static inline bool IsConstructTrampolineFrame(Address pc); private: friend class StackFrame;};class JavaScriptFrame: public StandardFrame { public: virtual Type type() const { return JAVA_SCRIPT; } // Accessors. inline Object* function() const; inline Object* receiver() const; inline void set_receiver(Object* value); // Access the parameters. Object* GetParameter(int index) const; int ComputeParametersCount() const; // Temporary way of getting access to the number of parameters // passed on the stack by the caller. Once argument adaptor frames // has been introduced on ARM, this number will always match the // computed parameters count. int GetProvidedParametersCount() const; // Check if this frame is a constructor frame invoked through // 'new'. The operation may involve digging through a few stack // frames to account for arguments adaptors. bool IsConstructor() const; // Check if this frame has "adapted" arguments in the sense that the // actual passed arguments are available in an arguments adaptor // frame below it on the stack. inline bool has_adapted_arguments() const; // Garbage colletion support. virtual void Iterate(ObjectVisitor* v) const; // Printing support. virtual void Print(StringStream* accumulator, PrintMode mode, int index) const; // Determine the code for the frame. virtual Code* FindCode() const; static JavaScriptFrame* cast(StackFrame* frame) { ASSERT(frame->is_java_script()); return static_cast<JavaScriptFrame*>(frame); } protected: explicit JavaScriptFrame(StackFrameIterator* iterator) : StandardFrame(iterator) { } virtual Address GetCallerStackPointer() const; private: friend class StackFrameIterator;};// Arguments adaptor frames are automatically inserted below// JavaScript frames when the actual number of parameters does not// match the formal number of parameters.class ArgumentsAdaptorFrame: public JavaScriptFrame { public: // This sentinel value is temporarily used to distinguish arguments // adaptor frames from ordinary JavaScript frames. If a frame has // the sentinel as its context, it is an arguments adaptor frame. It // must be tagged as a small integer to avoid GC issues. Crud. enum { SENTINEL = (1 << kSmiTagSize) | kSmiTag }; virtual Type type() const { return ARGUMENTS_ADAPTOR; } // Determine the code for the frame. virtual Code* FindCode() const; static ArgumentsAdaptorFrame* cast(StackFrame* frame) { ASSERT(frame->is_arguments_adaptor()); return static_cast<ArgumentsAdaptorFrame*>(frame); } // Printing support. virtual void Print(StringStream* accumulator, PrintMode mode, int index) const; protected: explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) : JavaScriptFrame(iterator) { } virtual Address GetCallerStackPointer() const; private: friend class StackFrameIterator;};class InternalFrame: public StandardFrame { public: virtual Type type() const { return INTERNAL; } // Returns if this frame is a special trampoline frame introduced by // the construct trampoline. NOTE: We should consider introducing a // special stack frame type for this. inline bool is_construct_trampoline() const; // Garbage colletion support. virtual void Iterate(ObjectVisitor* v) const; // Determine the code for the frame. virtual Code* FindCode() const; static InternalFrame* cast(StackFrame* frame) { ASSERT(frame->is_internal()); return static_cast<InternalFrame*>(frame); } protected: explicit InternalFrame(StackFrameIterator* iterator) : StandardFrame(iterator) { } virtual Address GetCallerStackPointer() const; private: friend class StackFrameIterator;};class StackFrameIterator BASE_EMBEDDED { public: // An iterator that iterates over the current thread's stack. StackFrameIterator(); // An iterator that iterates over a given thread's stack. explicit StackFrameIterator(ThreadLocalTop* thread); StackFrame* frame() const { ASSERT(!done()); return frame_; } bool done() const { return frame_ == NULL; } void Advance(); // Go back to the first frame. void Reset(); private:#define DECLARE_SINGLETON(ignore, type) type type##_; STACK_FRAME_TYPE_LIST(DECLARE_SINGLETON)#undef DECLARE_SINGLETON StackFrame* frame_; StackHandler* handler_; ThreadLocalTop* thread_; StackHandler* handler() const { ASSERT(!done()); return handler_; } // Get the type-specific frame singleton in a given state. StackFrame* SingletonFor(StackFrame::Type type, StackFrame::State* state); friend class StackFrame; DISALLOW_COPY_AND_ASSIGN(StackFrameIterator);};// Iterator that supports iterating through all JavaScript frames.class JavaScriptFrameIterator BASE_EMBEDDED { public: JavaScriptFrameIterator() { if (!done()) Advance(); } explicit JavaScriptFrameIterator(ThreadLocalTop* thread) : iterator_(thread) { if (!done()) Advance(); } // Skip frames until the frame with the given id is reached. explicit JavaScriptFrameIterator(StackFrame::Id id); inline JavaScriptFrame* frame() const; bool done() const { return iterator_.done(); } void Advance(); // Advance to the frame holding the arguments for the current // frame. This only affects the current frame if it has adapted // arguments. void AdvanceToArgumentsFrame(); // Go back to the first frame. void Reset(); private: StackFrameIterator iterator_;};class StackFrameLocator BASE_EMBEDDED { public: // Find the nth JavaScript frame on the stack. The caller must // guarantee that such a frame exists. JavaScriptFrame* FindJavaScriptFrame(int n); private: StackFrameIterator iterator_;};} } // namespace v8::internal#endif // V8_FRAMES_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -