| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 unsigned bailout_id, | 585 unsigned bailout_id, |
| 582 Address from, | 586 Address from, |
| 583 int fp_to_sp_delta, | 587 int fp_to_sp_delta, |
| 584 Code* optimized_code); | 588 Code* optimized_code); |
| 585 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); | 589 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); |
| 586 void PrintFunctionName(); | 590 void PrintFunctionName(); |
| 587 void DeleteFrameDescriptions(); | 591 void DeleteFrameDescriptions(); |
| 588 | 592 |
| 589 void DoComputeOutputFrames(); | 593 void DoComputeOutputFrames(); |
| 590 void DoComputeJSFrame(int frame_index); | 594 void DoComputeJSFrame(int frame_index); |
| 595 void DoComputeInterpretedFrame(int frame_index); |
| 591 void DoComputeArgumentsAdaptorFrame(int frame_index); | 596 void DoComputeArgumentsAdaptorFrame(int frame_index); |
| 592 void DoComputeConstructStubFrame(int frame_index); | 597 void DoComputeConstructStubFrame(int frame_index); |
| 593 void DoComputeAccessorStubFrame(int frame_index, bool is_setter_stub_frame); | 598 void DoComputeAccessorStubFrame(int frame_index, bool is_setter_stub_frame); |
| 594 void DoComputeCompiledStubFrame(int frame_index); | 599 void DoComputeCompiledStubFrame(int frame_index); |
| 595 | 600 |
| 596 void WriteTranslatedValueToOutput( | 601 void WriteTranslatedValueToOutput( |
| 597 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, | 602 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, |
| 598 unsigned output_offset, const char* debug_hint_string = nullptr, | 603 unsigned output_offset, const char* debug_hint_string = nullptr, |
| 599 Address output_address_for_materialization = nullptr); | 604 Address output_address_for_materialization = nullptr); |
| 600 void WriteValueToOutput(Object* value, int input_index, int frame_index, | 605 void WriteValueToOutput(Object* value, int input_index, int frame_index, |
| 601 unsigned output_offset, | 606 unsigned output_offset, |
| 602 const char* debug_hint_string); | 607 const char* debug_hint_string); |
| 603 void DebugPrintOutputSlot(intptr_t value, int frame_index, | 608 void DebugPrintOutputSlot(intptr_t value, int frame_index, |
| 604 unsigned output_offset, | 609 unsigned output_offset, |
| 605 const char* debug_hint_string); | 610 const char* debug_hint_string); |
| 606 | 611 |
| 607 unsigned ComputeInputFrameSize() const; | 612 unsigned ComputeInputFrameSize() const; |
| 608 unsigned ComputeFixedSize(JSFunction* function) const; | 613 unsigned ComputeFixedSize(JSFunction* function, StackFrame::Type type) const; |
| 609 | 614 |
| 610 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 615 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
| 611 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); | 616 static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id); |
| 612 | 617 |
| 613 Object* ComputeLiteral(int index) const; | 618 Object* ComputeLiteral(int index) const; |
| 614 | 619 |
| 615 static void GenerateDeoptimizationEntries( | 620 static void GenerateDeoptimizationEntries( |
| 616 MacroAssembler* masm, int count, BailoutType type); | 621 MacroAssembler* masm, int count, BailoutType type); |
| 617 | 622 |
| 618 // Marks all the code in the given context for deoptimization. | 623 // Marks all the code in the given context for deoptimization. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 | 948 |
| 944 private: | 949 private: |
| 945 ByteArray* buffer_; | 950 ByteArray* buffer_; |
| 946 int index_; | 951 int index_; |
| 947 }; | 952 }; |
| 948 | 953 |
| 949 | 954 |
| 950 #define TRANSLATION_OPCODE_LIST(V) \ | 955 #define TRANSLATION_OPCODE_LIST(V) \ |
| 951 V(BEGIN) \ | 956 V(BEGIN) \ |
| 952 V(JS_FRAME) \ | 957 V(JS_FRAME) \ |
| 958 V(INTERPRETED_FRAME) \ |
| 953 V(CONSTRUCT_STUB_FRAME) \ | 959 V(CONSTRUCT_STUB_FRAME) \ |
| 954 V(GETTER_STUB_FRAME) \ | 960 V(GETTER_STUB_FRAME) \ |
| 955 V(SETTER_STUB_FRAME) \ | 961 V(SETTER_STUB_FRAME) \ |
| 956 V(ARGUMENTS_ADAPTOR_FRAME) \ | 962 V(ARGUMENTS_ADAPTOR_FRAME) \ |
| 957 V(COMPILED_STUB_FRAME) \ | 963 V(COMPILED_STUB_FRAME) \ |
| 958 V(DUPLICATED_OBJECT) \ | 964 V(DUPLICATED_OBJECT) \ |
| 959 V(ARGUMENTS_OBJECT) \ | 965 V(ARGUMENTS_OBJECT) \ |
| 960 V(CAPTURED_OBJECT) \ | 966 V(CAPTURED_OBJECT) \ |
| 961 V(REGISTER) \ | 967 V(REGISTER) \ |
| 962 V(INT32_REGISTER) \ | 968 V(INT32_REGISTER) \ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 988 zone_(zone) { | 994 zone_(zone) { |
| 989 buffer_->Add(BEGIN, zone); | 995 buffer_->Add(BEGIN, zone); |
| 990 buffer_->Add(frame_count, zone); | 996 buffer_->Add(frame_count, zone); |
| 991 buffer_->Add(jsframe_count, zone); | 997 buffer_->Add(jsframe_count, zone); |
| 992 } | 998 } |
| 993 | 999 |
| 994 int index() const { return index_; } | 1000 int index() const { return index_; } |
| 995 | 1001 |
| 996 // Commands. | 1002 // Commands. |
| 997 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 1003 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
| 1004 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
| 1005 unsigned height); |
| 998 void BeginCompiledStubFrame(int height); | 1006 void BeginCompiledStubFrame(int height); |
| 999 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 1007 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
| 1000 void BeginConstructStubFrame(int literal_id, unsigned height); | 1008 void BeginConstructStubFrame(int literal_id, unsigned height); |
| 1001 void BeginGetterStubFrame(int literal_id); | 1009 void BeginGetterStubFrame(int literal_id); |
| 1002 void BeginSetterStubFrame(int literal_id); | 1010 void BeginSetterStubFrame(int literal_id); |
| 1003 void BeginArgumentsObject(int args_length); | 1011 void BeginArgumentsObject(int args_length); |
| 1004 void BeginCapturedObject(int length); | 1012 void BeginCapturedObject(int length); |
| 1005 void DuplicateObject(int object_index); | 1013 void DuplicateObject(int object_index); |
| 1006 void StoreRegister(Register reg); | 1014 void StoreRegister(Register reg); |
| 1007 void StoreInt32Register(Register reg); | 1015 void StoreInt32Register(Register reg); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 Object** expression_stack_; | 1136 Object** expression_stack_; |
| 1129 int source_position_; | 1137 int source_position_; |
| 1130 | 1138 |
| 1131 friend class Deoptimizer; | 1139 friend class Deoptimizer; |
| 1132 }; | 1140 }; |
| 1133 | 1141 |
| 1134 } // namespace internal | 1142 } // namespace internal |
| 1135 } // namespace v8 | 1143 } // namespace v8 |
| 1136 | 1144 |
| 1137 #endif // V8_DEOPTIMIZER_H_ | 1145 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |