| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static const int kContextOffset = 3 * kPointerSize; | 92 static const int kContextOffset = 3 * kPointerSize; |
| 93 static const int kFPOffset = 4 * kPointerSize; | 93 static const int kFPOffset = 4 * kPointerSize; |
| 94 | 94 |
| 95 static const int kSize = kFPOffset + kPointerSize; | 95 static const int kSize = kFPOffset + kPointerSize; |
| 96 static const int kSlotCount = kSize >> kPointerSizeLog2; | 96 static const int kSlotCount = kSize >> kPointerSizeLog2; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | 99 |
| 100 class StackHandler BASE_EMBEDDED { | 100 class StackHandler BASE_EMBEDDED { |
| 101 public: | 101 public: |
| 102 // Generated code in MacroAssembler::Throw relies on the bit patterns of |
| 103 // the Kinds. Low-order bit determines if the handler is for optimized |
| 104 // code. |
| 102 enum Kind { | 105 enum Kind { |
| 103 JS_ENTRY, | 106 JS_ENTRY, // Non-optimized. |
| 104 CATCH, | 107 CATCH = 2, // Non-optimized, |
| 108 OPTIMIZED_CATCH, |
| 105 FINALLY, | 109 FINALLY, |
| 106 LAST_KIND = FINALLY | 110 LAST_KIND = FINALLY |
| 107 }; | 111 }; |
| 112 static const int kIsOptimizedMask = 1; |
| 108 | 113 |
| 109 static const int kKindWidth = 2; | 114 static const int kKindWidth = 3; |
| 110 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); | 115 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); |
| 111 static const int kIndexWidth = 32 - kKindWidth; | 116 static const int kIndexWidth = 32 - kKindWidth; |
| 112 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; | 117 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; |
| 113 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; | 118 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; |
| 114 | 119 |
| 115 // Get the address of this stack handler. | 120 // Get the address of this stack handler. |
| 116 inline Address address() const; | 121 inline Address address() const; |
| 117 | 122 |
| 118 // Get the next stack handler in the chain. | 123 // Get the next stack handler in the chain. |
| 119 inline StackHandler* next() const; | 124 inline StackHandler* next() const; |
| 120 | 125 |
| 126 inline Code* code() const; |
| 127 inline unsigned index() const; |
| 128 |
| 121 // Tells whether the given address is inside this handler. | 129 // Tells whether the given address is inside this handler. |
| 122 inline bool includes(Address address) const; | 130 inline bool includes(Address address) const; |
| 123 | 131 |
| 124 // Garbage collection support. | 132 // Garbage collection support. |
| 125 inline void Iterate(ObjectVisitor* v, Code* holder) const; | 133 inline void Iterate(ObjectVisitor* v, Code* holder) const; |
| 126 | 134 |
| 127 // Conversion support. | 135 // Conversion support. |
| 128 static inline StackHandler* FromAddress(Address address); | 136 static inline StackHandler* FromAddress(Address address); |
| 129 | 137 |
| 130 // Testers | 138 // Testers |
| 131 inline bool is_js_entry() const; | 139 inline bool is_js_entry() const; |
| 132 inline bool is_catch() const; | 140 inline bool is_catch() const; |
| 133 inline bool is_finally() const; | 141 inline bool is_finally() const; |
| 142 inline bool is_optimized() const; |
| 134 | 143 |
| 135 // Generator support to preserve stack handlers. | 144 // Generator support to preserve stack handlers. |
| 136 void Unwind(Isolate* isolate, FixedArray* array, int offset, | 145 void Unwind(Isolate* isolate, FixedArray* array, int offset, |
| 137 int previous_handler_offset) const; | 146 int previous_handler_offset) const; |
| 138 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); | 147 int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp); |
| 139 | 148 |
| 140 private: | 149 private: |
| 141 // Accessors. | 150 // Accessors. |
| 142 inline Kind kind() const; | 151 inline Kind kind() const; |
| 143 inline unsigned index() const; | |
| 144 | 152 |
| 145 inline Object** context_address() const; | 153 inline Object** context_address() const; |
| 146 inline Object** code_address() const; | 154 inline Object** code_address() const; |
| 147 | 155 |
| 148 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 156 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
| 149 }; | 157 }; |
| 150 | 158 |
| 151 | 159 |
| 152 #define STACK_FRAME_TYPE_LIST(V) \ | 160 #define STACK_FRAME_TYPE_LIST(V) \ |
| 153 V(ENTRY, EntryFrame) \ | 161 V(ENTRY, EntryFrame) \ |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 }; | 984 }; |
| 977 | 985 |
| 978 | 986 |
| 979 // Reads all frames on the current stack and copies them into the current | 987 // Reads all frames on the current stack and copies them into the current |
| 980 // zone memory. | 988 // zone memory. |
| 981 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); | 989 Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone); |
| 982 | 990 |
| 983 } } // namespace v8::internal | 991 } } // namespace v8::internal |
| 984 | 992 |
| 985 #endif // V8_FRAMES_H_ | 993 #endif // V8_FRAMES_H_ |
| OLD | NEW |