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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 static const int kSlotCount = kSize >> kPointerSizeLog2; | 81 static const int kSlotCount = kSize >> kPointerSizeLog2; |
82 }; | 82 }; |
83 | 83 |
84 | 84 |
85 class StackHandler BASE_EMBEDDED { | 85 class StackHandler BASE_EMBEDDED { |
86 public: | 86 public: |
87 enum Kind { | 87 enum Kind { |
88 JS_ENTRY, | 88 JS_ENTRY, |
89 CATCH, | 89 CATCH, |
90 FINALLY, | 90 FINALLY, |
91 LAST_KIND = FINALLY | |
92 }; | 91 }; |
93 | 92 |
94 static const int kKindWidth = 2; | |
95 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); | |
96 static const int kIndexWidth = 32 - kKindWidth; | |
97 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; | |
98 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; | |
99 | |
100 // Get the address of this stack handler. | 93 // Get the address of this stack handler. |
101 inline Address address() const; | 94 inline Address address() const; |
102 | 95 |
103 // Get the next stack handler in the chain. | 96 // Get the next stack handler in the chain. |
104 inline StackHandler* next() const; | 97 inline StackHandler* next() const; |
105 | 98 |
106 // Tells whether the given address is inside this handler. | 99 // Tells whether the given address is inside this handler. |
107 inline bool includes(Address address) const; | 100 inline bool includes(Address address) const; |
108 | 101 |
109 // Garbage collection support. | 102 // Garbage collection support. |
110 inline void Iterate(ObjectVisitor* v, Code* holder) const; | 103 inline void Iterate(ObjectVisitor* v, Code* holder) const; |
111 | 104 |
112 // Conversion support. | 105 // Conversion support. |
113 static inline StackHandler* FromAddress(Address address); | 106 static inline StackHandler* FromAddress(Address address); |
114 | 107 |
115 // Accessors. | 108 // Accessors. |
116 inline Context* context() const; | 109 inline Context* context() const; |
117 inline Kind kind() const; | 110 inline int index() const; |
118 inline unsigned index() const; | |
119 | |
120 // Testers. | |
121 inline bool is_js_entry() const; | |
122 inline bool is_catch() const; | |
123 inline bool is_finally() const; | |
124 | 111 |
125 // Generator support to preserve stack handlers. | 112 // Generator support to preserve stack handlers. |
126 void Unwind(Isolate* isolate, FixedArray* array, int offset, | 113 void Unwind(Isolate* isolate, FixedArray* array, int offset, |
127 int previous_handler_offset) const; | 114 int previous_handler_offset) const; |
128 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); | 115 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); |
129 | 116 |
130 private: | 117 private: |
131 inline Object** context_address() const; | 118 inline Object** context_address() const; |
132 | 119 |
133 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 }; | 919 }; |
933 | 920 |
934 | 921 |
935 // Reads all frames on the current stack and copies them into the current | 922 // Reads all frames on the current stack and copies them into the current |
936 // zone memory. | 923 // zone memory. |
937 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 924 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
938 | 925 |
939 } } // namespace v8::internal | 926 } } // namespace v8::internal |
940 | 927 |
941 #endif // V8_FRAMES_H_ | 928 #endif // V8_FRAMES_H_ |
OLD | NEW |