| 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" |
| 11 #include "src/source-position.h" | 11 #include "src/source-position.h" |
| 12 #include "src/zone/zone-chunk-list.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 class FrameDescription; | 17 class FrameDescription; |
| 17 class TranslationIterator; | 18 class TranslationIterator; |
| 18 class DeoptimizedFrameInfo; | 19 class DeoptimizedFrameInfo; |
| 19 class TranslatedState; | 20 class TranslatedState; |
| 20 class RegisterValues; | 21 class RegisterValues; |
| 21 | 22 |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 Deoptimizer* current_; | 838 Deoptimizer* current_; |
| 838 | 839 |
| 839 friend class Deoptimizer; | 840 friend class Deoptimizer; |
| 840 | 841 |
| 841 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); | 842 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); |
| 842 }; | 843 }; |
| 843 | 844 |
| 844 | 845 |
| 845 class TranslationBuffer BASE_EMBEDDED { | 846 class TranslationBuffer BASE_EMBEDDED { |
| 846 public: | 847 public: |
| 847 explicit TranslationBuffer(Zone* zone) : contents_(256, zone) { } | 848 explicit TranslationBuffer(Zone* zone) : contents_(zone) {} |
| 848 | 849 |
| 849 int CurrentIndex() const { return contents_.length(); } | 850 int CurrentIndex() const { return static_cast<int>(contents_.size()); } |
| 850 void Add(int32_t value, Zone* zone); | 851 void Add(int32_t value); |
| 851 | 852 |
| 852 Handle<ByteArray> CreateByteArray(Factory* factory); | 853 Handle<ByteArray> CreateByteArray(Factory* factory); |
| 853 | 854 |
| 854 private: | 855 private: |
| 855 ZoneList<uint8_t> contents_; | 856 ZoneChunkList<uint8_t> contents_; |
| 856 }; | 857 }; |
| 857 | 858 |
| 858 | 859 |
| 859 class TranslationIterator BASE_EMBEDDED { | 860 class TranslationIterator BASE_EMBEDDED { |
| 860 public: | 861 public: |
| 861 TranslationIterator(ByteArray* buffer, int index) | 862 TranslationIterator(ByteArray* buffer, int index) |
| 862 : buffer_(buffer), index_(index) { | 863 : buffer_(buffer), index_(index) { |
| 863 DCHECK(index >= 0 && index < buffer->length()); | 864 DCHECK(index >= 0 && index < buffer->length()); |
| 864 } | 865 } |
| 865 | 866 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) | 911 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) |
| 911 LAST = LITERAL | 912 LAST = LITERAL |
| 912 }; | 913 }; |
| 913 #undef DECLARE_TRANSLATION_OPCODE_ENUM | 914 #undef DECLARE_TRANSLATION_OPCODE_ENUM |
| 914 | 915 |
| 915 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count, | 916 Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count, |
| 916 Zone* zone) | 917 Zone* zone) |
| 917 : buffer_(buffer), | 918 : buffer_(buffer), |
| 918 index_(buffer->CurrentIndex()), | 919 index_(buffer->CurrentIndex()), |
| 919 zone_(zone) { | 920 zone_(zone) { |
| 920 buffer_->Add(BEGIN, zone); | 921 buffer_->Add(BEGIN); |
| 921 buffer_->Add(frame_count, zone); | 922 buffer_->Add(frame_count); |
| 922 buffer_->Add(jsframe_count, zone); | 923 buffer_->Add(jsframe_count); |
| 923 } | 924 } |
| 924 | 925 |
| 925 int index() const { return index_; } | 926 int index() const { return index_; } |
| 926 | 927 |
| 927 // Commands. | 928 // Commands. |
| 928 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 929 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
| 929 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, | 930 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
| 930 unsigned height); | 931 unsigned height); |
| 931 void BeginCompiledStubFrame(int height); | 932 void BeginCompiledStubFrame(int height); |
| 932 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 933 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 std::vector<Handle<Object> > expression_stack_; | 1055 std::vector<Handle<Object> > expression_stack_; |
| 1055 int source_position_; | 1056 int source_position_; |
| 1056 | 1057 |
| 1057 friend class Deoptimizer; | 1058 friend class Deoptimizer; |
| 1058 }; | 1059 }; |
| 1059 | 1060 |
| 1060 } // namespace internal | 1061 } // namespace internal |
| 1061 } // namespace v8 | 1062 } // namespace v8 |
| 1062 | 1063 |
| 1063 #endif // V8_DEOPTIMIZER_H_ | 1064 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |