Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_FRAMES_H_ | 5 #ifndef V8_FRAMES_H_ |
| 6 #define V8_FRAMES_H_ | 6 #define V8_FRAMES_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 #include "src/safepoint-table.h" | 10 #include "src/safepoint-table.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 class JavaScriptFrame; | 634 class JavaScriptFrame; |
| 635 | 635 |
| 636 class FrameSummary BASE_EMBEDDED { | 636 class FrameSummary BASE_EMBEDDED { |
| 637 public: | 637 public: |
| 638 FrameSummary(Object* receiver, JSFunction* function, | 638 FrameSummary(Object* receiver, JSFunction* function, |
| 639 AbstractCode* abstract_code, int code_offset, | 639 AbstractCode* abstract_code, int code_offset, |
| 640 bool is_constructor); | 640 bool is_constructor); |
| 641 | 641 |
| 642 static FrameSummary GetFirst(JavaScriptFrame* frame); | 642 static FrameSummary GetFirst(JavaScriptFrame* frame); |
| 643 | 643 |
| 644 Handle<Object> receiver() { return receiver_; } | 644 Handle<Object> receiver() const { return receiver_; } |
|
titzer
2016/04/22 12:16:25
AFAICT FrameSummary instances are already immutabl
Clemens Hammacher
2016/04/26 14:00:10
Removed the const.
| |
| 645 Handle<JSFunction> function() { return function_; } | 645 Handle<JSFunction> function() const { return function_; } |
| 646 Handle<AbstractCode> abstract_code() { return abstract_code_; } | 646 Handle<AbstractCode> abstract_code() const { return abstract_code_; } |
| 647 int code_offset() { return code_offset_; } | 647 int code_offset() const { return code_offset_; } |
| 648 bool is_constructor() { return is_constructor_; } | 648 bool is_constructor() const { return is_constructor_; } |
| 649 | 649 |
| 650 void Print(); | 650 void Print(); |
| 651 | 651 |
| 652 private: | 652 private: |
| 653 Handle<Object> receiver_; | 653 Handle<Object> receiver_; |
| 654 Handle<JSFunction> function_; | 654 Handle<JSFunction> function_; |
| 655 Handle<AbstractCode> abstract_code_; | 655 Handle<AbstractCode> abstract_code_; |
| 656 int code_offset_; | 656 int code_offset_; |
| 657 bool is_constructor_; | 657 bool is_constructor_; |
| 658 }; | 658 }; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 670 inline void SetExpression(int index, Object* value); | 670 inline void SetExpression(int index, Object* value); |
| 671 int ComputeExpressionsCount() const; | 671 int ComputeExpressionsCount() const; |
| 672 | 672 |
| 673 void SetCallerFp(Address caller_fp) override; | 673 void SetCallerFp(Address caller_fp) override; |
| 674 | 674 |
| 675 static StandardFrame* cast(StackFrame* frame) { | 675 static StandardFrame* cast(StackFrame* frame) { |
| 676 DCHECK(frame->is_standard()); | 676 DCHECK(frame->is_standard()); |
| 677 return static_cast<StandardFrame*>(frame); | 677 return static_cast<StandardFrame*>(frame); |
| 678 } | 678 } |
| 679 | 679 |
| 680 // Build a list with summaries for this frame including all inlined frames. | |
| 681 virtual void Summarize(List<FrameSummary>* frames) const; | |
| 682 | |
| 683 // Accessors. | |
| 684 virtual JSFunction* function() const; | |
| 685 virtual Object* receiver() const; | |
| 686 | |
| 687 protected: | 680 protected: |
| 688 inline explicit StandardFrame(StackFrameIteratorBase* iterator); | 681 inline explicit StandardFrame(StackFrameIteratorBase* iterator); |
| 689 | 682 |
| 690 void ComputeCallerState(State* state) const override; | 683 void ComputeCallerState(State* state) const override; |
| 691 | 684 |
| 692 // Accessors. | 685 // Accessors. |
| 693 inline Address caller_fp() const; | 686 inline Address caller_fp() const; |
| 694 inline Address caller_pc() const; | 687 inline Address caller_pc() const; |
| 695 | 688 |
| 696 // Computes the address of the PC field in the standard frame given | 689 // Computes the address of the PC field in the standard frame given |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 721 | 714 |
| 722 private: | 715 private: |
| 723 friend class StackFrame; | 716 friend class StackFrame; |
| 724 friend class SafeStackFrameIterator; | 717 friend class SafeStackFrameIterator; |
| 725 }; | 718 }; |
| 726 | 719 |
| 727 class JavaScriptFrame : public StandardFrame { | 720 class JavaScriptFrame : public StandardFrame { |
| 728 public: | 721 public: |
| 729 Type type() const override { return JAVA_SCRIPT; } | 722 Type type() const override { return JAVA_SCRIPT; } |
| 730 | 723 |
| 731 JSFunction* function() const override; | 724 // Build a list with summaries for this frame including all inlined frames. |
| 732 Object* receiver() const override; | 725 virtual void Summarize(List<FrameSummary>* frames) const; |
| 726 | |
| 727 // Accessors. | |
| 728 virtual JSFunction* function() const; | |
| 729 virtual Object* receiver() const; | |
| 733 | 730 |
| 734 inline void set_receiver(Object* value); | 731 inline void set_receiver(Object* value); |
| 735 | 732 |
| 736 // Access the parameters. | 733 // Access the parameters. |
| 737 inline Address GetParameterSlot(int index) const; | 734 inline Address GetParameterSlot(int index) const; |
| 738 inline Object* GetParameter(int index) const; | 735 inline Object* GetParameter(int index) const; |
| 739 inline int ComputeParametersCount() const { | 736 inline int ComputeParametersCount() const { |
| 740 return GetNumberOfIncomingArguments(); | 737 return GetNumberOfIncomingArguments(); |
| 741 } | 738 } |
| 742 | 739 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 770 // Printing support. | 767 // Printing support. |
| 771 void Print(StringStream* accumulator, PrintMode mode, | 768 void Print(StringStream* accumulator, PrintMode mode, |
| 772 int index) const override; | 769 int index) const override; |
| 773 | 770 |
| 774 // Determine the code for the frame. | 771 // Determine the code for the frame. |
| 775 Code* unchecked_code() const override; | 772 Code* unchecked_code() const override; |
| 776 | 773 |
| 777 // Return a list with JSFunctions of this frame. | 774 // Return a list with JSFunctions of this frame. |
| 778 virtual void GetFunctions(List<JSFunction*>* functions) const; | 775 virtual void GetFunctions(List<JSFunction*>* functions) const; |
| 779 | 776 |
| 780 void Summarize(List<FrameSummary>* frames) const override; | |
| 781 | |
| 782 // Lookup exception handler for current {pc}, returns -1 if none found. Also | 777 // Lookup exception handler for current {pc}, returns -1 if none found. Also |
| 783 // returns data associated with the handler site specific to the frame type: | 778 // returns data associated with the handler site specific to the frame type: |
| 784 // - JavaScriptFrame : Data is the stack depth at entry of the try-block. | 779 // - JavaScriptFrame : Data is the stack depth at entry of the try-block. |
| 785 // - OptimizedFrame : Data is the stack slot count of the entire frame. | 780 // - OptimizedFrame : Data is the stack slot count of the entire frame. |
| 786 // - InterpretedFrame: Data is the register index holding the context. | 781 // - InterpretedFrame: Data is the register index holding the context. |
| 787 virtual int LookupExceptionHandlerInTable( | 782 virtual int LookupExceptionHandlerInTable( |
| 788 int* data, HandlerTable::CatchPrediction* prediction); | 783 int* data, HandlerTable::CatchPrediction* prediction); |
| 789 | 784 |
| 790 // Architecture-specific register description. | 785 // Architecture-specific register description. |
| 791 static Register fp_register(); | 786 static Register fp_register(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 // GC support. | 948 // GC support. |
| 954 void Iterate(ObjectVisitor* v) const override; | 949 void Iterate(ObjectVisitor* v) const override; |
| 955 | 950 |
| 956 // Printing support. | 951 // Printing support. |
| 957 void Print(StringStream* accumulator, PrintMode mode, | 952 void Print(StringStream* accumulator, PrintMode mode, |
| 958 int index) const override; | 953 int index) const override; |
| 959 | 954 |
| 960 // Determine the code for the frame. | 955 // Determine the code for the frame. |
| 961 Code* unchecked_code() const override; | 956 Code* unchecked_code() const override; |
| 962 | 957 |
| 958 Object* wasm_obj(Handle<Code> code = Handle<Code>()); | |
| 959 uint32_t function_index(Handle<Code> code = Handle<Code>()); | |
| 960 | |
| 961 Object* function_name(Handle<Code> code = Handle<Code>()); | |
| 962 | |
| 963 static WasmFrame* cast(StackFrame* frame) { | 963 static WasmFrame* cast(StackFrame* frame) { |
| 964 DCHECK(frame->is_wasm()); | 964 DCHECK(frame->is_wasm()); |
| 965 return static_cast<WasmFrame*>(frame); | 965 return static_cast<WasmFrame*>(frame); |
| 966 } | 966 } |
| 967 | 967 |
| 968 JSFunction* function() const override; | |
| 969 | |
| 970 void Summarize(List<FrameSummary>* frames) const override; | |
| 971 | |
| 972 protected: | 968 protected: |
| 973 inline explicit WasmFrame(StackFrameIteratorBase* iterator); | 969 inline explicit WasmFrame(StackFrameIteratorBase* iterator); |
| 974 | 970 |
| 975 Address GetCallerStackPointer() const override; | 971 Address GetCallerStackPointer() const override; |
| 976 | 972 |
| 977 private: | 973 private: |
| 978 friend class StackFrameIteratorBase; | 974 friend class StackFrameIteratorBase; |
| 979 }; | 975 }; |
| 980 | 976 |
| 981 class WasmToJsFrame : public StubFrame { | 977 class WasmToJsFrame : public StubFrame { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1211 | 1207 |
| 1212 | 1208 |
| 1213 // Reads all frames on the current stack and copies them into the current | 1209 // Reads all frames on the current stack and copies them into the current |
| 1214 // zone memory. | 1210 // zone memory. |
| 1215 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 1211 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 1216 | 1212 |
| 1217 } // namespace internal | 1213 } // namespace internal |
| 1218 } // namespace v8 | 1214 } // namespace v8 |
| 1219 | 1215 |
| 1220 #endif // V8_FRAMES_H_ | 1216 #endif // V8_FRAMES_H_ |
| OLD | NEW |