Chromium Code Reviews| Index: src/frames.h |
| diff --git a/src/frames.h b/src/frames.h |
| index f33eb167414af18081c82864dde237c3f5a46c2e..fe289b28206790d3e71f673c51a5584b21c22d0e 100644 |
| --- a/src/frames.h |
| +++ b/src/frames.h |
| @@ -97,13 +97,13 @@ class StackHandler BASE_EMBEDDED { |
| DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
| }; |
| - |
| #define STACK_FRAME_TYPE_LIST(V) \ |
| V(ENTRY, EntryFrame) \ |
| V(ENTRY_CONSTRUCT, EntryConstructFrame) \ |
| V(EXIT, ExitFrame) \ |
| V(JAVA_SCRIPT, JavaScriptFrame) \ |
| V(OPTIMIZED, OptimizedFrame) \ |
| + V(WASM, WasmFrame) \ |
| V(INTERPRETED, InterpretedFrame) \ |
| V(STUB, StubFrame) \ |
| V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \ |
| @@ -310,6 +310,7 @@ class StackFrame BASE_EMBEDDED { |
| bool is_exit() const { return type() == EXIT; } |
| bool is_optimized() const { return type() == OPTIMIZED; } |
| bool is_interpreted() const { return type() == INTERPRETED; } |
| + bool is_wasm() const { return type() == WASM; } |
| bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } |
| bool is_internal() const { return type() == INTERNAL; } |
| bool is_stub_failure_trampoline() const { |
| @@ -324,6 +325,11 @@ class StackFrame BASE_EMBEDDED { |
| (type == INTERPRETED); |
| } |
| + bool is_visible() const { |
| + Type type = this->type(); |
| + return is_java_script() || (type == WASM); |
| + } |
| + |
| // Accessors. |
| Address sp() const { return state_.sp; } |
| Address fp() const { return state_.fp; } |
| @@ -617,8 +623,24 @@ class FrameSummary BASE_EMBEDDED { |
| bool is_constructor_; |
| }; |
| +class VisibleFrame : public StandardFrame { |
|
Michael Starzinger
2016/02/19 21:23:13
It seems that we are already special-casing the WA
JF
2016/02/19 21:43:51
Possible yes, but the current approach is what tit
mvstanton
2016/02/19 21:54:04
Maybe Ben can chime in, it does seem a big change,
Michael Starzinger
2016/02/19 21:55:23
Just looking at this CL (i.e. the change in Isolat
JF
2016/02/19 21:55:53
Yup, you all know the codebase and I don't so I'll
|
| + public: |
| + // Build a list with summaries for this frame including all inlined frames. |
| + virtual void Summarize(List<FrameSummary>* frames) = 0; |
| -class JavaScriptFrame: public StandardFrame { |
| + static VisibleFrame* cast(StackFrame* frame) { |
| + DCHECK(frame->is_visible()); |
| + return static_cast<VisibleFrame*>(frame); |
| + } |
| + |
| + protected: |
| + inline explicit VisibleFrame(StackFrameIteratorBase* iterator); |
| + |
| + private: |
| + friend class StackFrameIteratorBase; |
| +}; |
| + |
| +class JavaScriptFrame : public VisibleFrame { |
| public: |
| Type type() const override { return JAVA_SCRIPT; } |
| @@ -673,7 +695,7 @@ class JavaScriptFrame: public StandardFrame { |
| virtual void GetFunctions(List<JSFunction*>* functions) const; |
| // Build a list with summaries for this frame including all inlined frames. |
| - virtual void Summarize(List<FrameSummary>* frames); |
| + void Summarize(List<FrameSummary>* frames) override; |
| // Lookup exception handler for current {pc}, returns -1 if none found. Also |
| // returns data associated with the handler site specific to the frame type: |
| @@ -841,6 +863,30 @@ class ArgumentsAdaptorFrame: public JavaScriptFrame { |
| friend class StackFrameIteratorBase; |
| }; |
| +class WasmFrame : public VisibleFrame { |
| + public: |
| + Type type() const override { return WASM; } |
| + |
| + // GC support. |
| + void Iterate(ObjectVisitor* v) const override; |
| + |
| + // Printing support. |
| + void Print(StringStream* accumulator, PrintMode mode, |
| + int index) const override; |
| + |
| + // Determine the code for the frame. |
| + Code* unchecked_code() const override; |
| + |
| + void Summarize(List<FrameSummary>* frames) override; |
| + |
| + protected: |
| + inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
| + |
| + Address GetCallerStackPointer() const override; |
| + |
| + private: |
| + friend class StackFrameIteratorBase; |
| +}; |
| class InternalFrame: public StandardFrame { |
| public: |
| @@ -974,9 +1020,25 @@ class StackFrameIterator: public StackFrameIteratorBase { |
| DISALLOW_COPY_AND_ASSIGN(StackFrameIterator); |
| }; |
| +// Iterator that supports iterating through all Visible frames. |
| +class VisibleFrameIterator BASE_EMBEDDED { |
| + public: |
| + inline explicit VisibleFrameIterator(Isolate* isolate); |
| + |
| + inline VisibleFrame* frame() const; |
| + |
| + bool done() const { return iterator_.done(); } |
| + void Advance(); |
| + |
| + protected: |
| + struct NoAdvance {}; // Sentinel: construct iterator_, but don't advance it. |
| + inline VisibleFrameIterator(Isolate* isolate, NoAdvance); |
| + inline VisibleFrameIterator(Isolate* isolate, ThreadLocalTop* top, NoAdvance); |
| + StackFrameIterator iterator_; |
| +}; |
| // Iterator that supports iterating through all JavaScript frames. |
| -class JavaScriptFrameIterator BASE_EMBEDDED { |
| +class JavaScriptFrameIterator : public VisibleFrameIterator { |
| public: |
| inline explicit JavaScriptFrameIterator(Isolate* isolate); |
| inline JavaScriptFrameIterator(Isolate* isolate, ThreadLocalTop* top); |
| @@ -985,16 +1047,12 @@ class JavaScriptFrameIterator BASE_EMBEDDED { |
| 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(); |
| - |
| - private: |
| - StackFrameIterator iterator_; |
| }; |