OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Get the id of this stack frame. | 141 // Get the id of this stack frame. |
142 Id id() const { return static_cast<Id>(OffsetFrom(pp())); } | 142 Id id() const { return static_cast<Id>(OffsetFrom(pp())); } |
143 | 143 |
144 // Checks if this frame includes any stack handlers. | 144 // Checks if this frame includes any stack handlers. |
145 bool HasHandler() const; | 145 bool HasHandler() const; |
146 | 146 |
147 // Get the type of this frame. | 147 // Get the type of this frame. |
148 virtual Type type() const = 0; | 148 virtual Type type() const = 0; |
149 | 149 |
150 // Get the code associated with this frame. | 150 // Get the code associated with this frame. |
151 virtual Code* FindCode() const = 0; | 151 virtual Code* code() const = 0; |
152 | 152 |
153 // Garbage collection support. | 153 // Garbage collection support. |
154 static void CookFramesForThread(ThreadLocalTop* thread); | 154 static void CookFramesForThread(ThreadLocalTop* thread); |
155 static void UncookFramesForThread(ThreadLocalTop* thread); | 155 static void UncookFramesForThread(ThreadLocalTop* thread); |
156 | 156 |
157 virtual void Iterate(ObjectVisitor* v) const { } | 157 virtual void Iterate(ObjectVisitor* v) const { } |
158 | 158 |
159 // Printing support. | 159 // Printing support. |
160 enum PrintMode { OVERVIEW, DETAILS }; | 160 enum PrintMode { OVERVIEW, DETAILS }; |
161 virtual void Print(StringStream* accumulator, | 161 virtual void Print(StringStream* accumulator, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrame); | 203 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrame); |
204 }; | 204 }; |
205 | 205 |
206 | 206 |
207 // Entry frames are used to enter JavaScript execution from C. | 207 // Entry frames are used to enter JavaScript execution from C. |
208 class EntryFrame: public StackFrame { | 208 class EntryFrame: public StackFrame { |
209 public: | 209 public: |
210 virtual Type type() const { return ENTRY; } | 210 virtual Type type() const { return ENTRY; } |
211 | 211 |
212 virtual Code* FindCode() const; | 212 virtual Code* code() const; |
213 | 213 |
214 // Garbage collection support. | 214 // Garbage collection support. |
215 virtual void Iterate(ObjectVisitor* v) const; | 215 virtual void Iterate(ObjectVisitor* v) const; |
216 | 216 |
217 static EntryFrame* cast(StackFrame* frame) { | 217 static EntryFrame* cast(StackFrame* frame) { |
218 ASSERT(frame->is_entry()); | 218 ASSERT(frame->is_entry()); |
219 return static_cast<EntryFrame*>(frame); | 219 return static_cast<EntryFrame*>(frame); |
220 } | 220 } |
221 | 221 |
222 protected: | 222 protected: |
223 explicit EntryFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } | 223 explicit EntryFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } |
224 | 224 |
225 // The caller stack pointer for entry frames is always zero. The | 225 // The caller stack pointer for entry frames is always zero. The |
226 // real information about the caller frame is available through the | 226 // real information about the caller frame is available through the |
227 // link to the top exit frame. | 227 // link to the top exit frame. |
228 virtual Address GetCallerStackPointer() const { return 0; } | 228 virtual Address GetCallerStackPointer() const { return 0; } |
229 | 229 |
230 private: | 230 private: |
231 virtual Type GetCallerState(State* state) const; | 231 virtual Type GetCallerState(State* state) const; |
232 | 232 |
233 friend class StackFrameIterator; | 233 friend class StackFrameIterator; |
234 }; | 234 }; |
235 | 235 |
236 | 236 |
237 class EntryConstructFrame: public EntryFrame { | 237 class EntryConstructFrame: public EntryFrame { |
238 public: | 238 public: |
239 virtual Type type() const { return ENTRY_CONSTRUCT; } | 239 virtual Type type() const { return ENTRY_CONSTRUCT; } |
240 | 240 |
241 virtual Code* FindCode() const; | 241 virtual Code* code() const; |
242 | 242 |
243 static EntryConstructFrame* cast(StackFrame* frame) { | 243 static EntryConstructFrame* cast(StackFrame* frame) { |
244 ASSERT(frame->is_entry_construct()); | 244 ASSERT(frame->is_entry_construct()); |
245 return static_cast<EntryConstructFrame*>(frame); | 245 return static_cast<EntryConstructFrame*>(frame); |
246 } | 246 } |
247 | 247 |
248 protected: | 248 protected: |
249 explicit EntryConstructFrame(StackFrameIterator* iterator) | 249 explicit EntryConstructFrame(StackFrameIterator* iterator) |
250 : EntryFrame(iterator) { } | 250 : EntryFrame(iterator) { } |
251 | 251 |
252 private: | 252 private: |
253 friend class StackFrameIterator; | 253 friend class StackFrameIterator; |
254 }; | 254 }; |
255 | 255 |
256 | 256 |
257 // Exit frames are used to exit JavaScript execution and go to C. | 257 // Exit frames are used to exit JavaScript execution and go to C. |
258 class ExitFrame: public StackFrame { | 258 class ExitFrame: public StackFrame { |
259 public: | 259 public: |
260 virtual Type type() const { return EXIT; } | 260 virtual Type type() const { return EXIT; } |
261 | 261 |
262 virtual Code* FindCode() const; | 262 virtual Code* code() const; |
263 | 263 |
264 // Garbage collection support. | 264 // Garbage collection support. |
265 virtual void Iterate(ObjectVisitor* v) const; | 265 virtual void Iterate(ObjectVisitor* v) const; |
266 | 266 |
267 static ExitFrame* cast(StackFrame* frame) { | 267 static ExitFrame* cast(StackFrame* frame) { |
268 ASSERT(frame->is_exit()); | 268 ASSERT(frame->is_exit()); |
269 return static_cast<ExitFrame*>(frame); | 269 return static_cast<ExitFrame*>(frame); |
270 } | 270 } |
271 | 271 |
272 // Compute the state and type of an exit frame given a frame | 272 // Compute the state and type of an exit frame given a frame |
(...skipping 10 matching lines...) Expand all Loading... |
283 virtual Type GetCallerState(State* state) const; | 283 virtual Type GetCallerState(State* state) const; |
284 | 284 |
285 friend class StackFrameIterator; | 285 friend class StackFrameIterator; |
286 }; | 286 }; |
287 | 287 |
288 | 288 |
289 class ExitDebugFrame: public ExitFrame { | 289 class ExitDebugFrame: public ExitFrame { |
290 public: | 290 public: |
291 virtual Type type() const { return EXIT_DEBUG; } | 291 virtual Type type() const { return EXIT_DEBUG; } |
292 | 292 |
293 virtual Code* FindCode() const; | 293 virtual Code* code() const; |
294 | 294 |
295 static ExitDebugFrame* cast(StackFrame* frame) { | 295 static ExitDebugFrame* cast(StackFrame* frame) { |
296 ASSERT(frame->is_exit_debug()); | 296 ASSERT(frame->is_exit_debug()); |
297 return static_cast<ExitDebugFrame*>(frame); | 297 return static_cast<ExitDebugFrame*>(frame); |
298 } | 298 } |
299 | 299 |
300 protected: | 300 protected: |
301 explicit ExitDebugFrame(StackFrameIterator* iterator) | 301 explicit ExitDebugFrame(StackFrameIterator* iterator) |
302 : ExitFrame(iterator) { } | 302 : ExitFrame(iterator) { } |
303 | 303 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 // Garbage collection support. | 393 // Garbage collection support. |
394 virtual void Iterate(ObjectVisitor* v) const; | 394 virtual void Iterate(ObjectVisitor* v) const; |
395 | 395 |
396 // Printing support. | 396 // Printing support. |
397 virtual void Print(StringStream* accumulator, | 397 virtual void Print(StringStream* accumulator, |
398 PrintMode mode, | 398 PrintMode mode, |
399 int index) const; | 399 int index) const; |
400 | 400 |
401 // Determine the code for the frame. | 401 // Determine the code for the frame. |
402 virtual Code* FindCode() const; | 402 virtual Code* code() const; |
403 | 403 |
404 static JavaScriptFrame* cast(StackFrame* frame) { | 404 static JavaScriptFrame* cast(StackFrame* frame) { |
405 ASSERT(frame->is_java_script()); | 405 ASSERT(frame->is_java_script()); |
406 return static_cast<JavaScriptFrame*>(frame); | 406 return static_cast<JavaScriptFrame*>(frame); |
407 } | 407 } |
408 | 408 |
409 protected: | 409 protected: |
410 explicit JavaScriptFrame(StackFrameIterator* iterator) | 410 explicit JavaScriptFrame(StackFrameIterator* iterator) |
411 : StandardFrame(iterator) { } | 411 : StandardFrame(iterator) { } |
412 | 412 |
(...skipping 13 matching lines...) Expand all Loading... |
426 // adaptor frames from ordinary JavaScript frames. If a frame has | 426 // adaptor frames from ordinary JavaScript frames. If a frame has |
427 // the sentinel as its context, it is an arguments adaptor frame. It | 427 // the sentinel as its context, it is an arguments adaptor frame. It |
428 // must be tagged as a small integer to avoid GC issues. Crud. | 428 // must be tagged as a small integer to avoid GC issues. Crud. |
429 enum { | 429 enum { |
430 SENTINEL = (1 << kSmiTagSize) | kSmiTag | 430 SENTINEL = (1 << kSmiTagSize) | kSmiTag |
431 }; | 431 }; |
432 | 432 |
433 virtual Type type() const { return ARGUMENTS_ADAPTOR; } | 433 virtual Type type() const { return ARGUMENTS_ADAPTOR; } |
434 | 434 |
435 // Determine the code for the frame. | 435 // Determine the code for the frame. |
436 virtual Code* FindCode() const; | 436 virtual Code* code() const; |
437 | 437 |
438 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { | 438 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { |
439 ASSERT(frame->is_arguments_adaptor()); | 439 ASSERT(frame->is_arguments_adaptor()); |
440 return static_cast<ArgumentsAdaptorFrame*>(frame); | 440 return static_cast<ArgumentsAdaptorFrame*>(frame); |
441 } | 441 } |
442 | 442 |
443 // Printing support. | 443 // Printing support. |
444 virtual void Print(StringStream* accumulator, | 444 virtual void Print(StringStream* accumulator, |
445 PrintMode mode, | 445 PrintMode mode, |
446 int index) const; | 446 int index) const; |
447 protected: | 447 protected: |
448 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) | 448 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) |
449 : JavaScriptFrame(iterator) { } | 449 : JavaScriptFrame(iterator) { } |
450 | 450 |
451 virtual Address GetCallerStackPointer() const; | 451 virtual Address GetCallerStackPointer() const; |
452 | 452 |
453 private: | 453 private: |
454 friend class StackFrameIterator; | 454 friend class StackFrameIterator; |
455 }; | 455 }; |
456 | 456 |
457 | 457 |
458 class InternalFrame: public StandardFrame { | 458 class InternalFrame: public StandardFrame { |
459 public: | 459 public: |
460 virtual Type type() const { return INTERNAL; } | 460 virtual Type type() const { return INTERNAL; } |
461 | 461 |
462 // Garbage collection support. | 462 // Garbage collection support. |
463 virtual void Iterate(ObjectVisitor* v) const; | 463 virtual void Iterate(ObjectVisitor* v) const; |
464 | 464 |
465 // Determine the code for the frame. | 465 // Determine the code for the frame. |
466 virtual Code* FindCode() const; | 466 virtual Code* code() const; |
467 | 467 |
468 static InternalFrame* cast(StackFrame* frame) { | 468 static InternalFrame* cast(StackFrame* frame) { |
469 ASSERT(frame->is_internal()); | 469 ASSERT(frame->is_internal()); |
470 return static_cast<InternalFrame*>(frame); | 470 return static_cast<InternalFrame*>(frame); |
471 } | 471 } |
472 | 472 |
473 protected: | 473 protected: |
474 explicit InternalFrame(StackFrameIterator* iterator) | 474 explicit InternalFrame(StackFrameIterator* iterator) |
475 : StandardFrame(iterator) { } | 475 : StandardFrame(iterator) { } |
476 | 476 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 JavaScriptFrame* FindJavaScriptFrame(int n); | 578 JavaScriptFrame* FindJavaScriptFrame(int n); |
579 | 579 |
580 private: | 580 private: |
581 StackFrameIterator iterator_; | 581 StackFrameIterator iterator_; |
582 }; | 582 }; |
583 | 583 |
584 | 584 |
585 } } // namespace v8::internal | 585 } } // namespace v8::internal |
586 | 586 |
587 #endif // V8_FRAMES_H_ | 587 #endif // V8_FRAMES_H_ |
OLD | NEW |