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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 class JavaScriptFrame: public StandardFrame { | 456 class JavaScriptFrame: public StandardFrame { |
457 public: | 457 public: |
458 virtual Type type() const { return JAVA_SCRIPT; } | 458 virtual Type type() const { return JAVA_SCRIPT; } |
459 | 459 |
460 // Accessors. | 460 // Accessors. |
461 inline Object* function() const; | 461 inline Object* function() const; |
462 inline Object* receiver() const; | 462 inline Object* receiver() const; |
463 inline void set_receiver(Object* value); | 463 inline void set_receiver(Object* value); |
464 | 464 |
465 // Access the parameters. | 465 // Access the parameters. |
466 inline Address GetParameterSlot(int index) const; | 466 Object* GetParameter(int index) const; |
467 inline Object* GetParameter(int index) const; | 467 int ComputeParametersCount() const; |
468 inline int ComputeParametersCount() const { | |
469 return GetNumberOfIncomingArguments(); | |
470 } | |
471 | 468 |
472 // Check if this frame is a constructor frame invoked through 'new'. | 469 // Check if this frame is a constructor frame invoked through 'new'. |
473 bool IsConstructor() const; | 470 bool IsConstructor() const; |
474 | 471 |
475 // Check if this frame has "adapted" arguments in the sense that the | 472 // Check if this frame has "adapted" arguments in the sense that the |
476 // actual passed arguments are available in an arguments adaptor | 473 // actual passed arguments are available in an arguments adaptor |
477 // frame below it on the stack. | 474 // frame below it on the stack. |
478 inline bool has_adapted_arguments() const; | 475 inline bool has_adapted_arguments() const; |
479 | 476 |
480 // Garbage collection support. | 477 // Garbage collection support. |
(...skipping 17 matching lines...) Expand all Loading... |
498 ASSERT(frame->is_java_script()); | 495 ASSERT(frame->is_java_script()); |
499 return static_cast<JavaScriptFrame*>(frame); | 496 return static_cast<JavaScriptFrame*>(frame); |
500 } | 497 } |
501 | 498 |
502 protected: | 499 protected: |
503 explicit JavaScriptFrame(StackFrameIterator* iterator) | 500 explicit JavaScriptFrame(StackFrameIterator* iterator) |
504 : StandardFrame(iterator) { } | 501 : StandardFrame(iterator) { } |
505 | 502 |
506 virtual Address GetCallerStackPointer() const; | 503 virtual Address GetCallerStackPointer() const; |
507 | 504 |
508 virtual int GetNumberOfIncomingArguments() const; | |
509 | |
510 // Garbage collection support. Iterates over incoming arguments, | 505 // Garbage collection support. Iterates over incoming arguments, |
511 // receiver, and any callee-saved registers. | 506 // receiver, and any callee-saved registers. |
512 void IterateArguments(ObjectVisitor* v) const; | 507 void IterateArguments(ObjectVisitor* v) const; |
513 | 508 |
514 private: | 509 private: |
515 inline Object* function_slot_object() const; | 510 inline Object* function_slot_object() const; |
516 | 511 |
517 friend class StackFrameIterator; | 512 friend class StackFrameIterator; |
518 friend class StackTracer; | 513 friend class StackTracer; |
519 }; | 514 }; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 555 } |
561 | 556 |
562 // Printing support. | 557 // Printing support. |
563 virtual void Print(StringStream* accumulator, | 558 virtual void Print(StringStream* accumulator, |
564 PrintMode mode, | 559 PrintMode mode, |
565 int index) const; | 560 int index) const; |
566 protected: | 561 protected: |
567 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) | 562 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) |
568 : JavaScriptFrame(iterator) { } | 563 : JavaScriptFrame(iterator) { } |
569 | 564 |
570 virtual int GetNumberOfIncomingArguments() const { | |
571 return Smi::cast(GetExpression(0))->value(); | |
572 } | |
573 | |
574 virtual Address GetCallerStackPointer() const; | 565 virtual Address GetCallerStackPointer() const; |
575 | 566 |
576 private: | 567 private: |
577 friend class StackFrameIterator; | 568 friend class StackFrameIterator; |
578 }; | 569 }; |
579 | 570 |
580 | 571 |
581 class InternalFrame: public StandardFrame { | 572 class InternalFrame: public StandardFrame { |
582 public: | 573 public: |
583 virtual Type type() const { return INTERNAL; } | 574 virtual Type type() const { return INTERNAL; } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 }; | 845 }; |
855 | 846 |
856 | 847 |
857 // Reads all frames on the current stack and copies them into the current | 848 // Reads all frames on the current stack and copies them into the current |
858 // zone memory. | 849 // zone memory. |
859 Vector<StackFrame*> CreateStackMap(); | 850 Vector<StackFrame*> CreateStackMap(); |
860 | 851 |
861 } } // namespace v8::internal | 852 } } // namespace v8::internal |
862 | 853 |
863 #endif // V8_FRAMES_H_ | 854 #endif // V8_FRAMES_H_ |
OLD | NEW |