| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 static const int kInnerPointerToCodeCacheSize = 1024; | 80 static const int kInnerPointerToCodeCacheSize = 1024; |
| 81 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]; | 81 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache); | 83 DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 | 86 |
| 87 class StackHandler BASE_EMBEDDED { | 87 class StackHandler BASE_EMBEDDED { |
| 88 public: | 88 public: |
| 89 // Generated code in MacroAssembler::Throw relies on the bit patterns of |
| 90 // the Kinds. Low-order bit determines if the handler is for optimized |
| 91 // code. |
| 89 enum Kind { | 92 enum Kind { |
| 90 JS_ENTRY, | 93 JS_ENTRY, // Non-optimized. |
| 91 CATCH, | 94 CATCH = 2, // Non-optimized, |
| 95 OPTIMIZED_CATCH, |
| 92 FINALLY, | 96 FINALLY, |
| 93 LAST_KIND = FINALLY | 97 LAST_KIND = FINALLY |
| 94 }; | 98 }; |
| 99 static const int kIsOptimizedMask = 1; |
| 95 | 100 |
| 96 static const int kKindWidth = 2; | 101 static const int kKindWidth = 3; |
| 97 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); | 102 STATIC_ASSERT(LAST_KIND < (1 << kKindWidth)); |
| 98 static const int kIndexWidth = 32 - kKindWidth; | 103 static const int kIndexWidth = 32 - kKindWidth; |
| 99 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; | 104 class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {}; |
| 100 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; | 105 class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {}; |
| 101 | 106 |
| 102 // Get the address of this stack handler. | 107 // Get the address of this stack handler. |
| 103 inline Address address() const; | 108 inline Address address() const; |
| 104 | 109 |
| 105 // Get the next stack handler in the chain. | 110 // Get the next stack handler in the chain. |
| 106 inline StackHandler* next() const; | 111 inline StackHandler* next() const; |
| 107 | 112 |
| 113 inline Code* code() const; |
| 114 inline int index() const; |
| 115 |
| 108 // Tells whether the given address is inside this handler. | 116 // Tells whether the given address is inside this handler. |
| 109 inline bool includes(Address address) const; | 117 inline bool includes(Address address) const; |
| 110 | 118 |
| 111 // Garbage collection support. | 119 // Garbage collection support. |
| 112 inline void Iterate(ObjectVisitor* v, Code* holder) const; | 120 inline void Iterate(ObjectVisitor* v, Code* holder) const; |
| 113 | 121 |
| 114 // Conversion support. | 122 // Conversion support. |
| 115 static inline StackHandler* FromAddress(Address address); | 123 static inline StackHandler* FromAddress(Address address); |
| 116 | 124 |
| 117 // Testers | 125 // Testers |
| 118 inline bool is_js_entry() const; | 126 inline bool is_js_entry() const; |
| 119 inline bool is_catch() const; | 127 inline bool is_catch() const; |
| 120 inline bool is_finally() const; | 128 inline bool is_finally() const; |
| 129 inline bool is_optimized() const; |
| 121 | 130 |
| 122 private: | 131 private: |
| 123 // Accessors. | 132 // Accessors. |
| 124 inline Kind kind() const; | 133 inline Kind kind() const; |
| 125 | 134 |
| 126 inline Object** context_address() const; | 135 inline Object** context_address() const; |
| 127 inline Object** code_address() const; | 136 inline Object** code_address() const; |
| 128 | 137 |
| 129 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 138 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
| 130 }; | 139 }; |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 }; | 902 }; |
| 894 | 903 |
| 895 | 904 |
| 896 // Reads all frames on the current stack and copies them into the current | 905 // Reads all frames on the current stack and copies them into the current |
| 897 // zone memory. | 906 // zone memory. |
| 898 Vector<StackFrame*> CreateStackMap(Zone* zone); | 907 Vector<StackFrame*> CreateStackMap(Zone* zone); |
| 899 | 908 |
| 900 } } // namespace v8::internal | 909 } } // namespace v8::internal |
| 901 | 910 |
| 902 #endif // V8_FRAMES_H_ | 911 #endif // V8_FRAMES_H_ |
| OLD | NEW |