| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 inline void set_pc(Address value); | 86 inline void set_pc(Address value); |
| 87 | 87 |
| 88 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); | 88 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 | 91 |
| 92 #define STACK_FRAME_TYPE_LIST(V) \ | 92 #define STACK_FRAME_TYPE_LIST(V) \ |
| 93 V(ENTRY, EntryFrame) \ | 93 V(ENTRY, EntryFrame) \ |
| 94 V(ENTRY_CONSTRUCT, EntryConstructFrame) \ | 94 V(ENTRY_CONSTRUCT, EntryConstructFrame) \ |
| 95 V(EXIT, ExitFrame) \ | 95 V(EXIT, ExitFrame) \ |
| 96 V(EXIT_DEBUG, ExitDebugFrame) \ |
| 96 V(JAVA_SCRIPT, JavaScriptFrame) \ | 97 V(JAVA_SCRIPT, JavaScriptFrame) \ |
| 97 V(INTERNAL, InternalFrame) \ | 98 V(INTERNAL, InternalFrame) \ |
| 98 V(CONSTRUCT, ConstructFrame) \ | 99 V(CONSTRUCT, ConstructFrame) \ |
| 99 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) | 100 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
| 100 | 101 |
| 101 | 102 |
| 102 // Abstract base class for all stack frames. | 103 // Abstract base class for all stack frames. |
| 103 class StackFrame BASE_EMBEDDED { | 104 class StackFrame BASE_EMBEDDED { |
| 104 public: | 105 public: |
| 105 #define DECLARE_TYPE(type, ignore) type, | 106 #define DECLARE_TYPE(type, ignore) type, |
| 106 enum Type { | 107 enum Type { |
| 107 NONE = 0, | 108 NONE = 0, |
| 108 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) | 109 STACK_FRAME_TYPE_LIST(DECLARE_TYPE) |
| 109 NUMBER_OF_TYPES | 110 NUMBER_OF_TYPES |
| 110 }; | 111 }; |
| 111 #undef DECLARE_TYPE | 112 #undef DECLARE_TYPE |
| 112 | 113 |
| 113 // Opaque data type for identifying stack frames. Used extensively | 114 // Opaque data type for identifying stack frames. Used extensively |
| 114 // by the debugger. | 115 // by the debugger. |
| 115 enum Id { NO_ID = 0 }; | 116 enum Id { NO_ID = 0 }; |
| 116 | 117 |
| 117 // Type testers. | 118 // Type testers. |
| 118 bool is_entry() const { return type() == ENTRY; } | 119 bool is_entry() const { return type() == ENTRY; } |
| 119 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } | 120 bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } |
| 120 bool is_exit() const { return type() == EXIT; } | 121 bool is_exit() const { return type() == EXIT; } |
| 122 bool is_exit_debug() const { return type() == EXIT_DEBUG; } |
| 121 bool is_java_script() const { return type() == JAVA_SCRIPT; } | 123 bool is_java_script() const { return type() == JAVA_SCRIPT; } |
| 122 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } | 124 bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; } |
| 123 bool is_internal() const { return type() == INTERNAL; } | 125 bool is_internal() const { return type() == INTERNAL; } |
| 124 bool is_construct() const { return type() == CONSTRUCT; } | 126 bool is_construct() const { return type() == CONSTRUCT; } |
| 125 virtual bool is_standard() const { return false; } | 127 virtual bool is_standard() const { return false; } |
| 126 | 128 |
| 127 // Accessors. | 129 // Accessors. |
| 128 Address sp() const { return state_.sp; } | 130 Address sp() const { return state_.sp; } |
| 129 Address fp() const { return state_.fp; } | 131 Address fp() const { return state_.fp; } |
| 130 Address caller_sp() const { return GetCallerStackPointer(); } | 132 Address caller_sp() const { return GetCallerStackPointer(); } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 : EntryFrame(iterator) { } | 253 : EntryFrame(iterator) { } |
| 252 | 254 |
| 253 private: | 255 private: |
| 254 friend class StackFrameIterator; | 256 friend class StackFrameIterator; |
| 255 }; | 257 }; |
| 256 | 258 |
| 257 | 259 |
| 258 // Exit frames are used to exit JavaScript execution and go to C. | 260 // Exit frames are used to exit JavaScript execution and go to C. |
| 259 class ExitFrame: public StackFrame { | 261 class ExitFrame: public StackFrame { |
| 260 public: | 262 public: |
| 261 enum Mode { MODE_NORMAL, MODE_DEBUG }; | |
| 262 virtual Type type() const { return EXIT; } | 263 virtual Type type() const { return EXIT; } |
| 263 | 264 |
| 264 virtual Code* code() const; | 265 virtual Code* code() const; |
| 265 | 266 |
| 266 Object*& code_slot() const; | |
| 267 | |
| 268 // Garbage collection support. | 267 // Garbage collection support. |
| 269 virtual void Iterate(ObjectVisitor* v) const; | 268 virtual void Iterate(ObjectVisitor* v) const; |
| 270 | 269 |
| 271 static ExitFrame* cast(StackFrame* frame) { | 270 static ExitFrame* cast(StackFrame* frame) { |
| 272 ASSERT(frame->is_exit()); | 271 ASSERT(frame->is_exit()); |
| 273 return static_cast<ExitFrame*>(frame); | 272 return static_cast<ExitFrame*>(frame); |
| 274 } | 273 } |
| 275 | 274 |
| 276 // Compute the state and type of an exit frame given a frame | 275 // Compute the state and type of an exit frame given a frame |
| 277 // pointer. Used when constructing the first stack frame seen by an | 276 // pointer. Used when constructing the first stack frame seen by an |
| 278 // iterator and the frames following entry frames. | 277 // iterator and the frames following entry frames. |
| 279 static Type GetStateForFramePointer(Address fp, State* state); | 278 static Type GetStateForFramePointer(Address fp, State* state); |
| 280 | 279 |
| 281 protected: | 280 protected: |
| 282 explicit ExitFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } | 281 explicit ExitFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } |
| 283 | 282 |
| 284 virtual Address GetCallerStackPointer() const; | 283 virtual Address GetCallerStackPointer() const; |
| 285 | 284 |
| 286 private: | 285 private: |
| 287 virtual void ComputeCallerState(State* state) const; | 286 virtual void ComputeCallerState(State* state) const; |
| 288 | 287 |
| 289 friend class StackFrameIterator; | 288 friend class StackFrameIterator; |
| 290 }; | 289 }; |
| 291 | 290 |
| 292 | 291 |
| 292 class ExitDebugFrame: public ExitFrame { |
| 293 public: |
| 294 virtual Type type() const { return EXIT_DEBUG; } |
| 295 |
| 296 virtual Code* code() const; |
| 297 |
| 298 static ExitDebugFrame* cast(StackFrame* frame) { |
| 299 ASSERT(frame->is_exit_debug()); |
| 300 return static_cast<ExitDebugFrame*>(frame); |
| 301 } |
| 302 |
| 303 protected: |
| 304 explicit ExitDebugFrame(StackFrameIterator* iterator) |
| 305 : ExitFrame(iterator) { } |
| 306 |
| 307 private: |
| 308 friend class StackFrameIterator; |
| 309 }; |
| 310 |
| 311 |
| 293 class StandardFrame: public StackFrame { | 312 class StandardFrame: public StackFrame { |
| 294 public: | 313 public: |
| 295 // Testers. | 314 // Testers. |
| 296 virtual bool is_standard() const { return true; } | 315 virtual bool is_standard() const { return true; } |
| 297 | 316 |
| 298 // Accessors. | 317 // Accessors. |
| 299 inline Object* context() const; | 318 inline Object* context() const; |
| 300 | 319 |
| 301 // Access the expressions in the stack frame including locals. | 320 // Access the expressions in the stack frame including locals. |
| 302 inline Object* GetExpression(int index) const; | 321 inline Object* GetExpression(int index) const; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 JavaScriptFrame* FindJavaScriptFrame(int n); | 669 JavaScriptFrame* FindJavaScriptFrame(int n); |
| 651 | 670 |
| 652 private: | 671 private: |
| 653 StackFrameIterator iterator_; | 672 StackFrameIterator iterator_; |
| 654 }; | 673 }; |
| 655 | 674 |
| 656 | 675 |
| 657 } } // namespace v8::internal | 676 } } // namespace v8::internal |
| 658 | 677 |
| 659 #endif // V8_FRAMES_H_ | 678 #endif // V8_FRAMES_H_ |
| OLD | NEW |