| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_DEOPTIMIZER_H_ | 5 #ifndef V8_DEOPTIMIZER_H_ |
| 6 #define V8_DEOPTIMIZER_H_ | 6 #define V8_DEOPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/deoptimize-reason.h" | 9 #include "src/deoptimize-reason.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 void GeneratePrologue(); | 492 void GeneratePrologue(); |
| 493 | 493 |
| 494 private: | 494 private: |
| 495 int count() const { return count_; } | 495 int count() const { return count_; } |
| 496 | 496 |
| 497 MacroAssembler* masm_; | 497 MacroAssembler* masm_; |
| 498 Deoptimizer::BailoutType type_; | 498 Deoptimizer::BailoutType type_; |
| 499 int count_; | 499 int count_; |
| 500 }; | 500 }; |
| 501 | 501 |
| 502 int ConvertJSFrameIndexToFrameIndex(int jsframe_index); | |
| 503 | |
| 504 static size_t GetMaxDeoptTableSize(); | 502 static size_t GetMaxDeoptTableSize(); |
| 505 | 503 |
| 506 static void EnsureCodeForDeoptimizationEntry(Isolate* isolate, | 504 static void EnsureCodeForDeoptimizationEntry(Isolate* isolate, |
| 507 BailoutType type, | 505 BailoutType type, |
| 508 int max_entry_id); | 506 int max_entry_id); |
| 509 | 507 |
| 510 Isolate* isolate() const { return isolate_; } | 508 Isolate* isolate() const { return isolate_; } |
| 511 | 509 |
| 512 private: | 510 private: |
| 513 static const int kMinNumberOfEntries = 64; | 511 static const int kMinNumberOfEntries = 64; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 const char* debug_hint_string); | 545 const char* debug_hint_string); |
| 548 | 546 |
| 549 unsigned ComputeInputFrameAboveFpFixedSize() const; | 547 unsigned ComputeInputFrameAboveFpFixedSize() const; |
| 550 unsigned ComputeInputFrameSize() const; | 548 unsigned ComputeInputFrameSize() const; |
| 551 static unsigned ComputeJavascriptFixedSize(SharedFunctionInfo* shared); | 549 static unsigned ComputeJavascriptFixedSize(SharedFunctionInfo* shared); |
| 552 static unsigned ComputeInterpretedFixedSize(SharedFunctionInfo* shared); | 550 static unsigned ComputeInterpretedFixedSize(SharedFunctionInfo* shared); |
| 553 | 551 |
| 554 static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo* shared); | 552 static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo* shared); |
| 555 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); | 553 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); |
| 556 | 554 |
| 557 Object* ComputeLiteral(int index) const; | |
| 558 | |
| 559 static void GenerateDeoptimizationEntries( | 555 static void GenerateDeoptimizationEntries( |
| 560 MacroAssembler* masm, int count, BailoutType type); | 556 MacroAssembler* masm, int count, BailoutType type); |
| 561 | 557 |
| 562 // Marks all the code in the given context for deoptimization. | 558 // Marks all the code in the given context for deoptimization. |
| 563 static void MarkAllCodeForContext(Context* native_context); | 559 static void MarkAllCodeForContext(Context* native_context); |
| 564 | 560 |
| 565 // Visit all the known optimized functions in a given context. | 561 // Visit all the known optimized functions in a given context. |
| 566 static void VisitAllOptimizedFunctionsForContext( | 562 static void VisitAllOptimizedFunctionsForContext( |
| 567 Context* context, OptimizedFunctionVisitor* visitor); | 563 Context* context, OptimizedFunctionVisitor* visitor); |
| 568 | 564 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 | 694 |
| 699 void operator delete(void* description) { | 695 void operator delete(void* description) { |
| 700 free(description); | 696 free(description); |
| 701 } | 697 } |
| 702 | 698 |
| 703 uint32_t GetFrameSize() const { | 699 uint32_t GetFrameSize() const { |
| 704 DCHECK(static_cast<uint32_t>(frame_size_) == frame_size_); | 700 DCHECK(static_cast<uint32_t>(frame_size_) == frame_size_); |
| 705 return static_cast<uint32_t>(frame_size_); | 701 return static_cast<uint32_t>(frame_size_); |
| 706 } | 702 } |
| 707 | 703 |
| 708 unsigned GetOffsetFromSlotIndex(int slot_index); | |
| 709 | |
| 710 intptr_t GetFrameSlot(unsigned offset) { | 704 intptr_t GetFrameSlot(unsigned offset) { |
| 711 return *GetFrameSlotPointer(offset); | 705 return *GetFrameSlotPointer(offset); |
| 712 } | 706 } |
| 713 | 707 |
| 714 Address GetFramePointerAddress() { | 708 Address GetFramePointerAddress() { |
| 715 int fp_offset = GetFrameSize() - parameter_count() * kPointerSize - | 709 int fp_offset = GetFrameSize() - parameter_count() * kPointerSize - |
| 716 StandardFrameConstants::kCallerSPOffset; | 710 StandardFrameConstants::kCallerSPOffset; |
| 717 return reinterpret_cast<Address>(GetFrameSlotPointer(fp_offset)); | 711 return reinterpret_cast<Address>(GetFrameSlotPointer(fp_offset)); |
| 718 } | 712 } |
| 719 | 713 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 814 |
| 821 // This must be at the end of the object as the object is allocated larger | 815 // This must be at the end of the object as the object is allocated larger |
| 822 // than it's definition indicate to extend this array. | 816 // than it's definition indicate to extend this array. |
| 823 intptr_t frame_content_[1]; | 817 intptr_t frame_content_[1]; |
| 824 | 818 |
| 825 intptr_t* GetFrameSlotPointer(unsigned offset) { | 819 intptr_t* GetFrameSlotPointer(unsigned offset) { |
| 826 DCHECK(offset < frame_size_); | 820 DCHECK(offset < frame_size_); |
| 827 return reinterpret_cast<intptr_t*>( | 821 return reinterpret_cast<intptr_t*>( |
| 828 reinterpret_cast<Address>(this) + frame_content_offset() + offset); | 822 reinterpret_cast<Address>(this) + frame_content_offset() + offset); |
| 829 } | 823 } |
| 830 | |
| 831 int ComputeFixedSize(); | |
| 832 }; | 824 }; |
| 833 | 825 |
| 834 | 826 |
| 835 class DeoptimizerData { | 827 class DeoptimizerData { |
| 836 public: | 828 public: |
| 837 explicit DeoptimizerData(MemoryAllocator* allocator); | 829 explicit DeoptimizerData(MemoryAllocator* allocator); |
| 838 ~DeoptimizerData(); | 830 ~DeoptimizerData(); |
| 839 | 831 |
| 840 private: | 832 private: |
| 841 MemoryAllocator* allocator_; | 833 MemoryAllocator* allocator_; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 std::vector<Handle<Object> > expression_stack_; | 1054 std::vector<Handle<Object> > expression_stack_; |
| 1063 int source_position_; | 1055 int source_position_; |
| 1064 | 1056 |
| 1065 friend class Deoptimizer; | 1057 friend class Deoptimizer; |
| 1066 }; | 1058 }; |
| 1067 | 1059 |
| 1068 } // namespace internal | 1060 } // namespace internal |
| 1069 } // namespace v8 | 1061 } // namespace v8 |
| 1070 | 1062 |
| 1071 #endif // V8_DEOPTIMIZER_H_ | 1063 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |