| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 Address from, | 280 Address from, |
| 281 int fp_to_sp_delta, | 281 int fp_to_sp_delta, |
| 282 Code* optimized_code); | 282 Code* optimized_code); |
| 283 void DeleteFrameDescriptions(); | 283 void DeleteFrameDescriptions(); |
| 284 | 284 |
| 285 void DoComputeOutputFrames(); | 285 void DoComputeOutputFrames(); |
| 286 void DoComputeOsrOutputFrame(); | 286 void DoComputeOsrOutputFrame(); |
| 287 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); | 287 void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); |
| 288 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, | 288 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, |
| 289 int frame_index); | 289 int frame_index); |
| 290 void DoComputeConstructStubFrame(TranslationIterator* iterator, |
| 291 int frame_index); |
| 290 void DoTranslateCommand(TranslationIterator* iterator, | 292 void DoTranslateCommand(TranslationIterator* iterator, |
| 291 int frame_index, | 293 int frame_index, |
| 292 unsigned output_offset); | 294 unsigned output_offset); |
| 293 // Translate a command for OSR. Updates the input offset to be used for | 295 // Translate a command for OSR. Updates the input offset to be used for |
| 294 // the next command. Returns false if translation of the command failed | 296 // the next command. Returns false if translation of the command failed |
| 295 // (e.g., a number conversion failed) and may or may not have updated the | 297 // (e.g., a number conversion failed) and may or may not have updated the |
| 296 // input offset. | 298 // input offset. |
| 297 bool DoOsrTranslateCommand(TranslationIterator* iterator, | 299 bool DoOsrTranslateCommand(TranslationIterator* iterator, |
| 298 int* input_offset); | 300 int* input_offset); |
| 299 | 301 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 430 |
| 429 intptr_t GetTop() const { return top_; } | 431 intptr_t GetTop() const { return top_; } |
| 430 void SetTop(intptr_t top) { top_ = top; } | 432 void SetTop(intptr_t top) { top_ = top; } |
| 431 | 433 |
| 432 intptr_t GetPc() const { return pc_; } | 434 intptr_t GetPc() const { return pc_; } |
| 433 void SetPc(intptr_t pc) { pc_ = pc; } | 435 void SetPc(intptr_t pc) { pc_ = pc; } |
| 434 | 436 |
| 435 intptr_t GetFp() const { return fp_; } | 437 intptr_t GetFp() const { return fp_; } |
| 436 void SetFp(intptr_t fp) { fp_ = fp; } | 438 void SetFp(intptr_t fp) { fp_ = fp; } |
| 437 | 439 |
| 440 intptr_t GetContext() const { return context_; } |
| 441 void SetContext(intptr_t context) { context_ = context; } |
| 442 |
| 438 Smi* GetState() const { return state_; } | 443 Smi* GetState() const { return state_; } |
| 439 void SetState(Smi* state) { state_ = state; } | 444 void SetState(Smi* state) { state_ = state; } |
| 440 | 445 |
| 441 void SetContinuation(intptr_t pc) { continuation_ = pc; } | 446 void SetContinuation(intptr_t pc) { continuation_ = pc; } |
| 442 | 447 |
| 443 StackFrame::Type GetFrameType() const { return type_; } | 448 StackFrame::Type GetFrameType() const { return type_; } |
| 444 void SetFrameType(StackFrame::Type type) { type_ = type; } | 449 void SetFrameType(StackFrame::Type type) { type_ = type; } |
| 445 | 450 |
| 446 // Get the incoming arguments count. | 451 // Get the incoming arguments count. |
| 447 int ComputeParametersCount(); | 452 int ComputeParametersCount(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to | 494 // Frame_size_ must hold a uint32_t value. It is only a uintptr_t to |
| 490 // keep the variable-size array frame_content_ of type intptr_t at | 495 // keep the variable-size array frame_content_ of type intptr_t at |
| 491 // the end of the structure aligned. | 496 // the end of the structure aligned. |
| 492 uintptr_t frame_size_; // Number of bytes. | 497 uintptr_t frame_size_; // Number of bytes. |
| 493 JSFunction* function_; | 498 JSFunction* function_; |
| 494 intptr_t registers_[Register::kNumRegisters]; | 499 intptr_t registers_[Register::kNumRegisters]; |
| 495 double double_registers_[DoubleRegister::kNumAllocatableRegisters]; | 500 double double_registers_[DoubleRegister::kNumAllocatableRegisters]; |
| 496 intptr_t top_; | 501 intptr_t top_; |
| 497 intptr_t pc_; | 502 intptr_t pc_; |
| 498 intptr_t fp_; | 503 intptr_t fp_; |
| 504 intptr_t context_; |
| 499 StackFrame::Type type_; | 505 StackFrame::Type type_; |
| 500 Smi* state_; | 506 Smi* state_; |
| 501 #ifdef DEBUG | 507 #ifdef DEBUG |
| 502 Code::Kind kind_; | 508 Code::Kind kind_; |
| 503 #endif | 509 #endif |
| 504 | 510 |
| 505 // Continuation is the PC where the execution continues after | 511 // Continuation is the PC where the execution continues after |
| 506 // deoptimizing. | 512 // deoptimizing. |
| 507 intptr_t continuation_; | 513 intptr_t continuation_; |
| 508 | 514 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 ByteArray* buffer_; | 559 ByteArray* buffer_; |
| 554 int index_; | 560 int index_; |
| 555 }; | 561 }; |
| 556 | 562 |
| 557 | 563 |
| 558 class Translation BASE_EMBEDDED { | 564 class Translation BASE_EMBEDDED { |
| 559 public: | 565 public: |
| 560 enum Opcode { | 566 enum Opcode { |
| 561 BEGIN, | 567 BEGIN, |
| 562 JS_FRAME, | 568 JS_FRAME, |
| 569 CONSTRUCT_STUB_FRAME, |
| 563 ARGUMENTS_ADAPTOR_FRAME, | 570 ARGUMENTS_ADAPTOR_FRAME, |
| 564 REGISTER, | 571 REGISTER, |
| 565 INT32_REGISTER, | 572 INT32_REGISTER, |
| 566 DOUBLE_REGISTER, | 573 DOUBLE_REGISTER, |
| 567 STACK_SLOT, | 574 STACK_SLOT, |
| 568 INT32_STACK_SLOT, | 575 INT32_STACK_SLOT, |
| 569 DOUBLE_STACK_SLOT, | 576 DOUBLE_STACK_SLOT, |
| 570 LITERAL, | 577 LITERAL, |
| 571 ARGUMENTS_OBJECT, | 578 ARGUMENTS_OBJECT, |
| 572 | 579 |
| 573 // A prefix indicating that the next command is a duplicate of the one | 580 // A prefix indicating that the next command is a duplicate of the one |
| 574 // that follows it. | 581 // that follows it. |
| 575 DUPLICATE | 582 DUPLICATE |
| 576 }; | 583 }; |
| 577 | 584 |
| 578 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count) | 585 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count) |
| 579 : buffer_(buffer), | 586 : buffer_(buffer), |
| 580 index_(buffer->CurrentIndex()) { | 587 index_(buffer->CurrentIndex()) { |
| 581 buffer_->Add(BEGIN); | 588 buffer_->Add(BEGIN); |
| 582 buffer_->Add(frame_count); | 589 buffer_->Add(frame_count); |
| 583 buffer_->Add(jsframe_count); | 590 buffer_->Add(jsframe_count); |
| 584 } | 591 } |
| 585 | 592 |
| 586 int index() const { return index_; } | 593 int index() const { return index_; } |
| 587 | 594 |
| 588 // Commands. | 595 // Commands. |
| 589 void BeginJSFrame(int node_id, int literal_id, unsigned height); | 596 void BeginJSFrame(int node_id, int literal_id, unsigned height); |
| 590 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 597 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
| 598 void BeginConstructStubFrame(int literal_id, unsigned height); |
| 591 void StoreRegister(Register reg); | 599 void StoreRegister(Register reg); |
| 592 void StoreInt32Register(Register reg); | 600 void StoreInt32Register(Register reg); |
| 593 void StoreDoubleRegister(DoubleRegister reg); | 601 void StoreDoubleRegister(DoubleRegister reg); |
| 594 void StoreStackSlot(int index); | 602 void StoreStackSlot(int index); |
| 595 void StoreInt32StackSlot(int index); | 603 void StoreInt32StackSlot(int index); |
| 596 void StoreDoubleStackSlot(int index); | 604 void StoreDoubleStackSlot(int index); |
| 597 void StoreLiteral(int literal_id); | 605 void StoreLiteral(int literal_id); |
| 598 void StoreArgumentsObject(); | 606 void StoreArgumentsObject(); |
| 599 void MarkDuplicate(); | 607 void MarkDuplicate(); |
| 600 | 608 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // Class used to represent an unoptimized frame when the debugger | 721 // Class used to represent an unoptimized frame when the debugger |
| 714 // needs to inspect a frame that is part of an optimized frame. The | 722 // needs to inspect a frame that is part of an optimized frame. The |
| 715 // internally used FrameDescription objects are not GC safe so for use | 723 // internally used FrameDescription objects are not GC safe so for use |
| 716 // by the debugger frame information is copied to an object of this type. | 724 // by the debugger frame information is copied to an object of this type. |
| 717 // Represents parameters in unadapted form so their number might mismatch | 725 // Represents parameters in unadapted form so their number might mismatch |
| 718 // formal parameter count. | 726 // formal parameter count. |
| 719 class DeoptimizedFrameInfo : public Malloced { | 727 class DeoptimizedFrameInfo : public Malloced { |
| 720 public: | 728 public: |
| 721 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, | 729 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, |
| 722 int frame_index, | 730 int frame_index, |
| 723 bool has_arguments_adaptor); | 731 bool has_arguments_adaptor, |
| 732 bool has_construct_stub); |
| 724 virtual ~DeoptimizedFrameInfo(); | 733 virtual ~DeoptimizedFrameInfo(); |
| 725 | 734 |
| 726 // GC support. | 735 // GC support. |
| 727 void Iterate(ObjectVisitor* v); | 736 void Iterate(ObjectVisitor* v); |
| 728 | 737 |
| 729 // Return the number of incoming arguments. | 738 // Return the number of incoming arguments. |
| 730 int parameters_count() { return parameters_count_; } | 739 int parameters_count() { return parameters_count_; } |
| 731 | 740 |
| 732 // Return the height of the expression stack. | 741 // Return the height of the expression stack. |
| 733 int expression_count() { return expression_count_; } | 742 int expression_count() { return expression_count_; } |
| 734 | 743 |
| 735 // Get the frame function. | 744 // Get the frame function. |
| 736 JSFunction* GetFunction() { | 745 JSFunction* GetFunction() { |
| 737 return function_; | 746 return function_; |
| 738 } | 747 } |
| 739 | 748 |
| 749 // Check if this frame is preceded by construct stub frame. The bottom-most |
| 750 // inlined frame might still be called by an uninlined construct stub. |
| 751 bool HasConstructStub() { |
| 752 return has_construct_stub_; |
| 753 } |
| 754 |
| 740 // Get an incoming argument. | 755 // Get an incoming argument. |
| 741 Object* GetParameter(int index) { | 756 Object* GetParameter(int index) { |
| 742 ASSERT(0 <= index && index < parameters_count()); | 757 ASSERT(0 <= index && index < parameters_count()); |
| 743 return parameters_[index]; | 758 return parameters_[index]; |
| 744 } | 759 } |
| 745 | 760 |
| 746 // Get an expression from the expression stack. | 761 // Get an expression from the expression stack. |
| 747 Object* GetExpression(int index) { | 762 Object* GetExpression(int index) { |
| 748 ASSERT(0 <= index && index < expression_count()); | 763 ASSERT(0 <= index && index < expression_count()); |
| 749 return expression_stack_[index]; | 764 return expression_stack_[index]; |
| 750 } | 765 } |
| 751 | 766 |
| 752 Address GetPc() { | 767 Address GetPc() { |
| 753 return reinterpret_cast<Address>(pc_); | 768 return reinterpret_cast<Address>(pc_); |
| 754 } | 769 } |
| 755 | 770 |
| 756 private: | 771 private: |
| 757 // Set the frame function. | |
| 758 void SetFunction(JSFunction* function) { | |
| 759 function_ = function; | |
| 760 } | |
| 761 | |
| 762 // Set an incoming argument. | 772 // Set an incoming argument. |
| 763 void SetParameter(int index, Object* obj) { | 773 void SetParameter(int index, Object* obj) { |
| 764 ASSERT(0 <= index && index < parameters_count()); | 774 ASSERT(0 <= index && index < parameters_count()); |
| 765 parameters_[index] = obj; | 775 parameters_[index] = obj; |
| 766 } | 776 } |
| 767 | 777 |
| 768 // Set an expression on the expression stack. | 778 // Set an expression on the expression stack. |
| 769 void SetExpression(int index, Object* obj) { | 779 void SetExpression(int index, Object* obj) { |
| 770 ASSERT(0 <= index && index < expression_count()); | 780 ASSERT(0 <= index && index < expression_count()); |
| 771 expression_stack_[index] = obj; | 781 expression_stack_[index] = obj; |
| 772 } | 782 } |
| 773 | 783 |
| 774 JSFunction* function_; | 784 JSFunction* function_; |
| 785 bool has_construct_stub_; |
| 775 int parameters_count_; | 786 int parameters_count_; |
| 776 int expression_count_; | 787 int expression_count_; |
| 777 Object** parameters_; | 788 Object** parameters_; |
| 778 Object** expression_stack_; | 789 Object** expression_stack_; |
| 779 intptr_t pc_; | 790 intptr_t pc_; |
| 780 | 791 |
| 781 friend class Deoptimizer; | 792 friend class Deoptimizer; |
| 782 }; | 793 }; |
| 783 #endif | 794 #endif |
| 784 | 795 |
| 785 } } // namespace v8::internal | 796 } } // namespace v8::internal |
| 786 | 797 |
| 787 #endif // V8_DEOPTIMIZER_H_ | 798 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |