| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 private: | 366 private: |
| 367 friend class StackFrame; | 367 friend class StackFrame; |
| 368 }; | 368 }; |
| 369 | 369 |
| 370 | 370 |
| 371 class JavaScriptFrame: public StandardFrame { | 371 class JavaScriptFrame: public StandardFrame { |
| 372 public: | 372 public: |
| 373 virtual Type type() const { return JAVA_SCRIPT; } | 373 virtual Type type() const { return JAVA_SCRIPT; } |
| 374 | 374 |
| 375 // Accessors. | 375 // Accessors. |
| 376 inline bool is_at_function() const; |
| 376 inline Object* function() const; | 377 inline Object* function() const; |
| 377 inline Object* receiver() const; | 378 inline Object* receiver() const; |
| 378 inline void set_receiver(Object* value); | 379 inline void set_receiver(Object* value); |
| 379 | 380 |
| 380 // Access the parameters. | 381 // Access the parameters. |
| 381 Object* GetParameter(int index) const; | 382 Object* GetParameter(int index) const; |
| 382 int ComputeParametersCount() const; | 383 int ComputeParametersCount() const; |
| 383 | 384 |
| 384 // Temporary way of getting access to the number of parameters | 385 // Temporary way of getting access to the number of parameters |
| 385 // passed on the stack by the caller. Once argument adaptor frames | 386 // passed on the stack by the caller. Once argument adaptor frames |
| (...skipping 20 matching lines...) Expand all Loading... |
| 406 // Determine the code for the frame. | 407 // Determine the code for the frame. |
| 407 virtual Code* code() const; | 408 virtual Code* code() const; |
| 408 | 409 |
| 409 static JavaScriptFrame* cast(StackFrame* frame) { | 410 static JavaScriptFrame* cast(StackFrame* frame) { |
| 410 ASSERT(frame->is_java_script()); | 411 ASSERT(frame->is_java_script()); |
| 411 return static_cast<JavaScriptFrame*>(frame); | 412 return static_cast<JavaScriptFrame*>(frame); |
| 412 } | 413 } |
| 413 | 414 |
| 414 protected: | 415 protected: |
| 415 explicit JavaScriptFrame(StackFrameIterator* iterator) | 416 explicit JavaScriptFrame(StackFrameIterator* iterator) |
| 416 : StandardFrame(iterator), disable_heap_access_(false) { } | 417 : StandardFrame(iterator) { } |
| 417 | 418 |
| 418 virtual Address GetCallerStackPointer() const; | 419 virtual Address GetCallerStackPointer() const; |
| 419 | 420 |
| 420 // When this mode is enabled it is not allowed to access heap objects. | |
| 421 // This is a special mode used when gathering stack samples in profiler. | |
| 422 // A shortcoming is that caller's SP value will be calculated incorrectly | |
| 423 // (see GetCallerStackPointer implementation), but it is not used for stack | |
| 424 // sampling. | |
| 425 void DisableHeapAccess() { disable_heap_access_ = true; } | |
| 426 | |
| 427 private: | 421 private: |
| 428 bool disable_heap_access_; | |
| 429 inline Object* function_slot_object() const; | 422 inline Object* function_slot_object() const; |
| 430 | 423 |
| 431 friend class StackFrameIterator; | 424 friend class StackFrameIterator; |
| 432 }; | 425 }; |
| 433 | 426 |
| 434 | 427 |
| 435 // Arguments adaptor frames are automatically inserted below | 428 // Arguments adaptor frames are automatically inserted below |
| 436 // JavaScript frames when the actual number of parameters does not | 429 // JavaScript frames when the actual number of parameters does not |
| 437 // match the formal number of parameters. | 430 // match the formal number of parameters. |
| 438 class ArgumentsAdaptorFrame: public JavaScriptFrame { | 431 class ArgumentsAdaptorFrame: public JavaScriptFrame { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 JavaScriptFrame* FindJavaScriptFrame(int n); | 673 JavaScriptFrame* FindJavaScriptFrame(int n); |
| 681 | 674 |
| 682 private: | 675 private: |
| 683 StackFrameIterator iterator_; | 676 StackFrameIterator iterator_; |
| 684 }; | 677 }; |
| 685 | 678 |
| 686 | 679 |
| 687 } } // namespace v8::internal | 680 } } // namespace v8::internal |
| 688 | 681 |
| 689 #endif // V8_FRAMES_H_ | 682 #endif // V8_FRAMES_H_ |
| OLD | NEW |