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; | |
377 inline Object* function() const; | 376 inline Object* function() const; |
378 inline Object* receiver() const; | 377 inline Object* receiver() const; |
379 inline void set_receiver(Object* value); | 378 inline void set_receiver(Object* value); |
380 | 379 |
381 // Access the parameters. | 380 // Access the parameters. |
382 Object* GetParameter(int index) const; | 381 Object* GetParameter(int index) const; |
383 int ComputeParametersCount() const; | 382 int ComputeParametersCount() const; |
384 | 383 |
385 // Temporary way of getting access to the number of parameters | 384 // Temporary way of getting access to the number of parameters |
386 // passed on the stack by the caller. Once argument adaptor frames | 385 // passed on the stack by the caller. Once argument adaptor frames |
(...skipping 20 matching lines...) Expand all Loading... | |
407 // Determine the code for the frame. | 406 // Determine the code for the frame. |
408 virtual Code* code() const; | 407 virtual Code* code() const; |
409 | 408 |
410 static JavaScriptFrame* cast(StackFrame* frame) { | 409 static JavaScriptFrame* cast(StackFrame* frame) { |
411 ASSERT(frame->is_java_script()); | 410 ASSERT(frame->is_java_script()); |
412 return static_cast<JavaScriptFrame*>(frame); | 411 return static_cast<JavaScriptFrame*>(frame); |
413 } | 412 } |
414 | 413 |
415 protected: | 414 protected: |
416 explicit JavaScriptFrame(StackFrameIterator* iterator) | 415 explicit JavaScriptFrame(StackFrameIterator* iterator) |
417 : StandardFrame(iterator) { } | 416 : StandardFrame(iterator), disable_heap_access_(false) { } |
418 | 417 |
419 virtual Address GetCallerStackPointer() const; | 418 virtual Address GetCallerStackPointer() const; |
420 | 419 |
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 | |
iposva
2009/04/13 23:16:09
Is there a way where you can ASSERT if the caller'
| |
423 // (see GetCallerStackPointer implementation), but it is not used for stack | |
424 // sampling. | |
425 void DisableHeapAccess() { disable_heap_access_ = true; } | |
426 | |
421 private: | 427 private: |
428 bool disable_heap_access_; | |
422 inline Object* function_slot_object() const; | 429 inline Object* function_slot_object() const; |
423 | 430 |
424 friend class StackFrameIterator; | 431 friend class StackFrameIterator; |
425 }; | 432 }; |
426 | 433 |
427 | 434 |
428 // Arguments adaptor frames are automatically inserted below | 435 // Arguments adaptor frames are automatically inserted below |
429 // JavaScript frames when the actual number of parameters does not | 436 // JavaScript frames when the actual number of parameters does not |
430 // match the formal number of parameters. | 437 // match the formal number of parameters. |
431 class ArgumentsAdaptorFrame: public JavaScriptFrame { | 438 class ArgumentsAdaptorFrame: public JavaScriptFrame { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 JavaScriptFrame* FindJavaScriptFrame(int n); | 680 JavaScriptFrame* FindJavaScriptFrame(int n); |
674 | 681 |
675 private: | 682 private: |
676 StackFrameIterator iterator_; | 683 StackFrameIterator iterator_; |
677 }; | 684 }; |
678 | 685 |
679 | 686 |
680 } } // namespace v8::internal | 687 } } // namespace v8::internal |
681 | 688 |
682 #endif // V8_FRAMES_H_ | 689 #endif // V8_FRAMES_H_ |
OLD | NEW |