OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // code which are of interest when making stack traces to pin-point the source | 111 // code which are of interest when making stack traces to pin-point the source |
112 // location of a stack frame as close as possible. The "statement position" is | 112 // location of a stack frame as close as possible. The "statement position" is |
113 // collected at the beginning at each statement, and is used to indicate | 113 // collected at the beginning at each statement, and is used to indicate |
114 // possible break locations. kNoPosition is used to indicate an | 114 // possible break locations. kNoPosition is used to indicate an |
115 // invalid/uninitialized position value. | 115 // invalid/uninitialized position value. |
116 static const int kNoPosition = -1; | 116 static const int kNoPosition = -1; |
117 | 117 |
118 enum Mode { | 118 enum Mode { |
119 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 119 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). |
120 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. | 120 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. |
121 CODE_TARGET_CONTEXT, // code target used for contextual loads. | 121 CODE_TARGET_CONTEXT, // Code target used for contextual loads. |
122 DEBUG_BREAK, | 122 DEBUG_BREAK, // Code target for the debugger statement. |
123 CODE_TARGET, // code target which is not any of the above. | 123 CODE_TARGET, // Code target which is not any of the above. |
124 EMBEDDED_OBJECT, | 124 EMBEDDED_OBJECT, |
125 | 125 |
126 // Everything after runtime_entry (inclusive) is not GC'ed. | 126 // Everything after runtime_entry (inclusive) is not GC'ed. |
127 RUNTIME_ENTRY, | 127 RUNTIME_ENTRY, |
128 JS_RETURN, // Marks start of the ExitJSFrame code. | 128 JS_RETURN, // Marks start of the ExitJSFrame code. |
129 COMMENT, | 129 COMMENT, |
130 POSITION, // See comment for kNoPosition above. | 130 POSITION, // See comment for kNoPosition above. |
131 STATEMENT_POSITION, // See comment for kNoPosition above. | 131 STATEMENT_POSITION, // See comment for kNoPosition above. |
| 132 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. |
132 EXTERNAL_REFERENCE, // The address of an external C++ function. | 133 EXTERNAL_REFERENCE, // The address of an external C++ function. |
133 INTERNAL_REFERENCE, // An address inside the same function. | 134 INTERNAL_REFERENCE, // An address inside the same function. |
134 | 135 |
135 // add more as needed | 136 // add more as needed |
136 // Pseudo-types | 137 // Pseudo-types |
137 NUMBER_OF_MODES, // must be no greater than 14 - see RelocInfoWriter | 138 NUMBER_OF_MODES, // must be no greater than 14 - see RelocInfoWriter |
138 NONE, // never recorded | 139 NONE, // never recorded |
139 LAST_CODE_ENUM = CODE_TARGET, | 140 LAST_CODE_ENUM = CODE_TARGET, |
140 LAST_GCED_ENUM = EMBEDDED_OBJECT | 141 LAST_GCED_ENUM = EMBEDDED_OBJECT |
141 }; | 142 }; |
(...skipping 25 matching lines...) Expand all Loading... |
167 } | 168 } |
168 static inline bool IsStatementPosition(Mode mode) { | 169 static inline bool IsStatementPosition(Mode mode) { |
169 return mode == STATEMENT_POSITION; | 170 return mode == STATEMENT_POSITION; |
170 } | 171 } |
171 static inline bool IsExternalReference(Mode mode) { | 172 static inline bool IsExternalReference(Mode mode) { |
172 return mode == EXTERNAL_REFERENCE; | 173 return mode == EXTERNAL_REFERENCE; |
173 } | 174 } |
174 static inline bool IsInternalReference(Mode mode) { | 175 static inline bool IsInternalReference(Mode mode) { |
175 return mode == INTERNAL_REFERENCE; | 176 return mode == INTERNAL_REFERENCE; |
176 } | 177 } |
| 178 static inline bool IsDebugBreakSlot(Mode mode) { |
| 179 return mode == DEBUG_BREAK_SLOT; |
| 180 } |
177 static inline int ModeMask(Mode mode) { return 1 << mode; } | 181 static inline int ModeMask(Mode mode) { return 1 << mode; } |
178 | 182 |
179 // Accessors | 183 // Accessors |
180 byte* pc() const { return pc_; } | 184 byte* pc() const { return pc_; } |
181 void set_pc(byte* pc) { pc_ = pc; } | 185 void set_pc(byte* pc) { pc_ = pc; } |
182 Mode rmode() const { return rmode_; } | 186 Mode rmode() const { return rmode_; } |
183 intptr_t data() const { return data_; } | 187 intptr_t data() const { return data_; } |
184 | 188 |
185 // Apply a relocation by delta bytes | 189 // Apply a relocation by delta bytes |
186 INLINE(void apply(intptr_t delta)); | 190 INLINE(void apply(intptr_t delta)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Patch the code with some other code. | 240 // Patch the code with some other code. |
237 void PatchCode(byte* instructions, int instruction_count); | 241 void PatchCode(byte* instructions, int instruction_count); |
238 | 242 |
239 // Patch the code with a call. | 243 // Patch the code with a call. |
240 void PatchCodeWithCall(Address target, int guard_bytes); | 244 void PatchCodeWithCall(Address target, int guard_bytes); |
241 | 245 |
242 // Check whether this return sequence has been patched | 246 // Check whether this return sequence has been patched |
243 // with a call to the debugger. | 247 // with a call to the debugger. |
244 INLINE(bool IsPatchedReturnSequence()); | 248 INLINE(bool IsPatchedReturnSequence()); |
245 | 249 |
| 250 // Check whether this debug break slot has been patched with a call to the |
| 251 // debugger. |
| 252 INLINE(bool IsPatchedDebugBreakSlotSequence()); |
| 253 |
246 #ifdef ENABLE_DISASSEMBLER | 254 #ifdef ENABLE_DISASSEMBLER |
247 // Printing | 255 // Printing |
248 static const char* RelocModeName(Mode rmode); | 256 static const char* RelocModeName(Mode rmode); |
249 void Print(); | 257 void Print(); |
250 #endif // ENABLE_DISASSEMBLER | 258 #endif // ENABLE_DISASSEMBLER |
251 #ifdef DEBUG | 259 #ifdef DEBUG |
252 // Debugging | 260 // Debugging |
253 void Verify(); | 261 void Verify(); |
254 #endif | 262 #endif |
255 | 263 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 unsigned int num_bits_set; | 564 unsigned int num_bits_set; |
557 for (num_bits_set = 0; x; x >>= 1) { | 565 for (num_bits_set = 0; x; x >>= 1) { |
558 num_bits_set += x & 1; | 566 num_bits_set += x & 1; |
559 } | 567 } |
560 return num_bits_set; | 568 return num_bits_set; |
561 } | 569 } |
562 | 570 |
563 } } // namespace v8::internal | 571 } } // namespace v8::internal |
564 | 572 |
565 #endif // V8_ASSEMBLER_H_ | 573 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |