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/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 double double_value() const; | 105 double double_value() const; |
106 int object_length() const; | 106 int object_length() const; |
107 int object_index() const; | 107 int object_index() const; |
108 }; | 108 }; |
109 | 109 |
110 | 110 |
111 class TranslatedFrame { | 111 class TranslatedFrame { |
112 public: | 112 public: |
113 enum Kind { | 113 enum Kind { |
114 kFunction, | 114 kFunction, |
| 115 kInterpretedFunction, |
115 kGetter, | 116 kGetter, |
116 kSetter, | 117 kSetter, |
117 kArgumentsAdaptor, | 118 kArgumentsAdaptor, |
118 kConstructStub, | 119 kConstructStub, |
119 kCompiledStub, | 120 kCompiledStub, |
120 kInvalid | 121 kInvalid |
121 }; | 122 }; |
122 | 123 |
123 int GetValueCount(); | 124 int GetValueCount(); |
124 | 125 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 reference front() { return values_.front(); } | 167 reference front() { return values_.front(); } |
167 const_reference front() const { return values_.front(); } | 168 const_reference front() const { return values_.front(); } |
168 | 169 |
169 private: | 170 private: |
170 friend class TranslatedState; | 171 friend class TranslatedState; |
171 | 172 |
172 // Constructor static methods. | 173 // Constructor static methods. |
173 static TranslatedFrame JSFrame(BailoutId node_id, | 174 static TranslatedFrame JSFrame(BailoutId node_id, |
174 SharedFunctionInfo* shared_info, int height); | 175 SharedFunctionInfo* shared_info, int height); |
| 176 static TranslatedFrame InterpretedFrame(BailoutId bytecode_offset, |
| 177 SharedFunctionInfo* shared_info, |
| 178 int height); |
175 static TranslatedFrame AccessorFrame(Kind kind, | 179 static TranslatedFrame AccessorFrame(Kind kind, |
176 SharedFunctionInfo* shared_info); | 180 SharedFunctionInfo* shared_info); |
177 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, | 181 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, |
178 int height); | 182 int height); |
179 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info, | 183 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info, |
180 int height); | 184 int height); |
181 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { | 185 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { |
182 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); | 186 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); |
183 } | 187 } |
184 static TranslatedFrame InvalidFrame() { | 188 static TranslatedFrame InvalidFrame() { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 unsigned bailout_id, | 586 unsigned bailout_id, |
583 Address from, | 587 Address from, |
584 int fp_to_sp_delta, | 588 int fp_to_sp_delta, |
585 Code* optimized_code); | 589 Code* optimized_code); |
586 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); | 590 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); |
587 void PrintFunctionName(); | 591 void PrintFunctionName(); |
588 void DeleteFrameDescriptions(); | 592 void DeleteFrameDescriptions(); |
589 | 593 |
590 void DoComputeOutputFrames(); | 594 void DoComputeOutputFrames(); |
591 void DoComputeJSFrame(int frame_index); | 595 void DoComputeJSFrame(int frame_index); |
| 596 void DoComputeInterpretedFrame(int frame_index); |
592 void DoComputeArgumentsAdaptorFrame(int frame_index); | 597 void DoComputeArgumentsAdaptorFrame(int frame_index); |
593 void DoComputeConstructStubFrame(int frame_index); | 598 void DoComputeConstructStubFrame(int frame_index); |
594 void DoComputeAccessorStubFrame(int frame_index, bool is_setter_stub_frame); | 599 void DoComputeAccessorStubFrame(int frame_index, bool is_setter_stub_frame); |
595 void DoComputeCompiledStubFrame(int frame_index); | 600 void DoComputeCompiledStubFrame(int frame_index); |
596 | 601 |
597 void WriteTranslatedValueToOutput( | 602 void WriteTranslatedValueToOutput( |
598 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, | 603 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, |
599 unsigned output_offset, const char* debug_hint_string = nullptr, | 604 unsigned output_offset, const char* debug_hint_string = nullptr, |
600 Address output_address_for_materialization = nullptr); | 605 Address output_address_for_materialization = nullptr); |
601 void WriteValueToOutput(Object* value, int input_index, int frame_index, | 606 void WriteValueToOutput(Object* value, int input_index, int frame_index, |
602 unsigned output_offset, | 607 unsigned output_offset, |
603 const char* debug_hint_string); | 608 const char* debug_hint_string); |
604 void DebugPrintOutputSlot(intptr_t value, int frame_index, | 609 void DebugPrintOutputSlot(intptr_t value, int frame_index, |
605 unsigned output_offset, | 610 unsigned output_offset, |
606 const char* debug_hint_string); | 611 const char* debug_hint_string); |
607 | 612 |
608 unsigned ComputeInputFrameSize() const; | 613 unsigned ComputeInputFrameSize() const; |
609 unsigned ComputeFixedSize(JSFunction* function) const; | 614 unsigned ComputeJavascriptFixedSize(JSFunction* function) const; |
| 615 unsigned ComputeInterpretedFixedSize(JSFunction* function) const; |
610 | 616 |
611 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 617 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
612 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); | 618 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); |
613 | 619 |
614 Object* ComputeLiteral(int index) const; | 620 Object* ComputeLiteral(int index) const; |
615 | 621 |
616 static void GenerateDeoptimizationEntries( | 622 static void GenerateDeoptimizationEntries( |
617 MacroAssembler* masm, int count, BailoutType type); | 623 MacroAssembler* masm, int count, BailoutType type); |
618 | 624 |
619 // Marks all the code in the given context for deoptimization. | 625 // Marks all the code in the given context for deoptimization. |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 | 950 |
945 private: | 951 private: |
946 ByteArray* buffer_; | 952 ByteArray* buffer_; |
947 int index_; | 953 int index_; |
948 }; | 954 }; |
949 | 955 |
950 | 956 |
951 #define TRANSLATION_OPCODE_LIST(V) \ | 957 #define TRANSLATION_OPCODE_LIST(V) \ |
952 V(BEGIN) \ | 958 V(BEGIN) \ |
953 V(JS_FRAME) \ | 959 V(JS_FRAME) \ |
| 960 V(INTERPRETED_FRAME) \ |
954 V(CONSTRUCT_STUB_FRAME) \ | 961 V(CONSTRUCT_STUB_FRAME) \ |
955 V(GETTER_STUB_FRAME) \ | 962 V(GETTER_STUB_FRAME) \ |
956 V(SETTER_STUB_FRAME) \ | 963 V(SETTER_STUB_FRAME) \ |
957 V(ARGUMENTS_ADAPTOR_FRAME) \ | 964 V(ARGUMENTS_ADAPTOR_FRAME) \ |
958 V(COMPILED_STUB_FRAME) \ | 965 V(COMPILED_STUB_FRAME) \ |
959 V(DUPLICATED_OBJECT) \ | 966 V(DUPLICATED_OBJECT) \ |
960 V(ARGUMENTS_OBJECT) \ | 967 V(ARGUMENTS_OBJECT) \ |
961 V(CAPTURED_OBJECT) \ | 968 V(CAPTURED_OBJECT) \ |
962 V(REGISTER) \ | 969 V(REGISTER) \ |
963 V(INT32_REGISTER) \ | 970 V(INT32_REGISTER) \ |
(...skipping 25 matching lines...) Expand all Loading... |
989 zone_(zone) { | 996 zone_(zone) { |
990 buffer_->Add(BEGIN, zone); | 997 buffer_->Add(BEGIN, zone); |
991 buffer_->Add(frame_count, zone); | 998 buffer_->Add(frame_count, zone); |
992 buffer_->Add(jsframe_count, zone); | 999 buffer_->Add(jsframe_count, zone); |
993 } | 1000 } |
994 | 1001 |
995 int index() const { return index_; } | 1002 int index() const { return index_; } |
996 | 1003 |
997 // Commands. | 1004 // Commands. |
998 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 1005 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
| 1006 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
| 1007 unsigned height); |
999 void BeginCompiledStubFrame(int height); | 1008 void BeginCompiledStubFrame(int height); |
1000 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 1009 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
1001 void BeginConstructStubFrame(int literal_id, unsigned height); | 1010 void BeginConstructStubFrame(int literal_id, unsigned height); |
1002 void BeginGetterStubFrame(int literal_id); | 1011 void BeginGetterStubFrame(int literal_id); |
1003 void BeginSetterStubFrame(int literal_id); | 1012 void BeginSetterStubFrame(int literal_id); |
1004 void BeginArgumentsObject(int args_length); | 1013 void BeginArgumentsObject(int args_length); |
1005 void BeginCapturedObject(int length); | 1014 void BeginCapturedObject(int length); |
1006 void DuplicateObject(int object_index); | 1015 void DuplicateObject(int object_index); |
1007 void StoreRegister(Register reg); | 1016 void StoreRegister(Register reg); |
1008 void StoreInt32Register(Register reg); | 1017 void StoreInt32Register(Register reg); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 Object** expression_stack_; | 1138 Object** expression_stack_; |
1130 int source_position_; | 1139 int source_position_; |
1131 | 1140 |
1132 friend class Deoptimizer; | 1141 friend class Deoptimizer; |
1133 }; | 1142 }; |
1134 | 1143 |
1135 } // namespace internal | 1144 } // namespace internal |
1136 } // namespace v8 | 1145 } // namespace v8 |
1137 | 1146 |
1138 #endif // V8_DEOPTIMIZER_H_ | 1147 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |