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 |
91 }; | 92 }; |
92 | 93 |
| 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 |
93 // Get the address of this stack handler. | 100 // Get the address of this stack handler. |
94 inline Address address() const; | 101 inline Address address() const; |
95 | 102 |
96 // Get the next stack handler in the chain. | 103 // Get the next stack handler in the chain. |
97 inline StackHandler* next() const; | 104 inline StackHandler* next() const; |
98 | 105 |
99 // Tells whether the given address is inside this handler. | 106 // Tells whether the given address is inside this handler. |
100 inline bool includes(Address address) const; | 107 inline bool includes(Address address) const; |
101 | 108 |
102 // Garbage collection support. | 109 // Garbage collection support. |
103 inline void Iterate(ObjectVisitor* v, Code* holder) const; | 110 inline void Iterate(ObjectVisitor* v, Code* holder) const; |
104 | 111 |
105 // Conversion support. | 112 // Conversion support. |
106 static inline StackHandler* FromAddress(Address address); | 113 static inline StackHandler* FromAddress(Address address); |
107 | 114 |
108 // Accessors. | 115 // Accessors. |
109 inline Context* context() const; | 116 inline Context* context() const; |
110 inline int index() const; | 117 inline Kind kind() 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; |
111 | 124 |
112 // Generator support to preserve stack handlers. | 125 // Generator support to preserve stack handlers. |
113 void Unwind(Isolate* isolate, FixedArray* array, int offset, | 126 void Unwind(Isolate* isolate, FixedArray* array, int offset, |
114 int previous_handler_offset) const; | 127 int previous_handler_offset) const; |
115 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); | 128 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); |
116 | 129 |
117 private: | 130 private: |
118 inline Object** context_address() const; | 131 inline Object** context_address() const; |
119 | 132 |
120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 133 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 }; | 932 }; |
920 | 933 |
921 | 934 |
922 // Reads all frames on the current stack and copies them into the current | 935 // Reads all frames on the current stack and copies them into the current |
923 // zone memory. | 936 // zone memory. |
924 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 937 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
925 | 938 |
926 } } // namespace v8::internal | 939 } } // namespace v8::internal |
927 | 940 |
928 #endif // V8_FRAMES_H_ | 941 #endif // V8_FRAMES_H_ |
OLD | NEW |