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