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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 public: | 152 public: |
153 enum Kind { | 153 enum Kind { |
154 kFunction, | 154 kFunction, |
155 kInterpretedFunction, | 155 kInterpretedFunction, |
156 kGetter, | 156 kGetter, |
157 kSetter, | 157 kSetter, |
158 kTailCallerFunction, | 158 kTailCallerFunction, |
159 kArgumentsAdaptor, | 159 kArgumentsAdaptor, |
160 kConstructStub, | 160 kConstructStub, |
161 kCompiledStub, | 161 kCompiledStub, |
| 162 kBuiltinContinuation, |
| 163 kJavaScriptBuiltinContinuation, |
162 kInvalid | 164 kInvalid |
163 }; | 165 }; |
164 | 166 |
165 int GetValueCount(); | 167 int GetValueCount(); |
166 | 168 |
167 Kind kind() const { return kind_; } | 169 Kind kind() const { return kind_; } |
168 BailoutId node_id() const { return node_id_; } | 170 BailoutId node_id() const { return node_id_; } |
169 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 171 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
170 int height() const { return height_; } | 172 int height() const { return height_; } |
171 | 173 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 SharedFunctionInfo* shared_info, | 225 SharedFunctionInfo* shared_info, |
224 int height); | 226 int height); |
225 static TranslatedFrame AccessorFrame(Kind kind, | 227 static TranslatedFrame AccessorFrame(Kind kind, |
226 SharedFunctionInfo* shared_info); | 228 SharedFunctionInfo* shared_info); |
227 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, | 229 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, |
228 int height); | 230 int height); |
229 static TranslatedFrame TailCallerFrame(SharedFunctionInfo* shared_info); | 231 static TranslatedFrame TailCallerFrame(SharedFunctionInfo* shared_info); |
230 static TranslatedFrame ConstructStubFrame(BailoutId bailout_id, | 232 static TranslatedFrame ConstructStubFrame(BailoutId bailout_id, |
231 SharedFunctionInfo* shared_info, | 233 SharedFunctionInfo* shared_info, |
232 int height); | 234 int height); |
| 235 static TranslatedFrame BuiltinContinuationFrame( |
| 236 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height); |
| 237 static TranslatedFrame JavaScriptBuiltinContinuationFrame( |
| 238 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height); |
233 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { | 239 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { |
234 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); | 240 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); |
235 } | 241 } |
236 static TranslatedFrame InvalidFrame() { | 242 static TranslatedFrame InvalidFrame() { |
237 return TranslatedFrame(kInvalid, nullptr); | 243 return TranslatedFrame(kInvalid, nullptr); |
238 } | 244 } |
239 | 245 |
240 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); | 246 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); |
241 | 247 |
242 TranslatedFrame(Kind kind, Isolate* isolate, | 248 TranslatedFrame(Kind kind, Isolate* isolate, |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 void DoComputeArgumentsAdaptorFrame(TranslatedFrame* translated_frame, | 567 void DoComputeArgumentsAdaptorFrame(TranslatedFrame* translated_frame, |
562 int frame_index); | 568 int frame_index); |
563 void DoComputeTailCallerFrame(TranslatedFrame* translated_frame, | 569 void DoComputeTailCallerFrame(TranslatedFrame* translated_frame, |
564 int frame_index); | 570 int frame_index); |
565 void DoComputeConstructStubFrame(TranslatedFrame* translated_frame, | 571 void DoComputeConstructStubFrame(TranslatedFrame* translated_frame, |
566 int frame_index); | 572 int frame_index); |
567 void DoComputeAccessorStubFrame(TranslatedFrame* translated_frame, | 573 void DoComputeAccessorStubFrame(TranslatedFrame* translated_frame, |
568 int frame_index, bool is_setter_stub_frame); | 574 int frame_index, bool is_setter_stub_frame); |
569 void DoComputeCompiledStubFrame(TranslatedFrame* translated_frame, | 575 void DoComputeCompiledStubFrame(TranslatedFrame* translated_frame, |
570 int frame_index); | 576 int frame_index); |
| 577 void DoComputeBuiltinContinuation(TranslatedFrame* translated_frame, |
| 578 int frame_index, bool java_script_frame); |
571 | 579 |
572 void WriteTranslatedValueToOutput( | 580 void WriteTranslatedValueToOutput( |
573 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, | 581 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, |
574 unsigned output_offset, const char* debug_hint_string = nullptr, | 582 unsigned output_offset, const char* debug_hint_string = nullptr, |
575 Address output_address_for_materialization = nullptr); | 583 Address output_address_for_materialization = nullptr); |
576 void WriteValueToOutput(Object* value, int input_index, int frame_index, | 584 void WriteValueToOutput(Object* value, int input_index, int frame_index, |
577 unsigned output_offset, | 585 unsigned output_offset, |
578 const char* debug_hint_string); | 586 const char* debug_hint_string); |
579 void DebugPrintOutputSlot(intptr_t value, int frame_index, | 587 void DebugPrintOutputSlot(intptr_t value, int frame_index, |
580 unsigned output_offset, | 588 unsigned output_offset, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 922 |
915 void Skip(int n) { | 923 void Skip(int n) { |
916 for (int i = 0; i < n; i++) Next(); | 924 for (int i = 0; i < n; i++) Next(); |
917 } | 925 } |
918 | 926 |
919 private: | 927 private: |
920 ByteArray* buffer_; | 928 ByteArray* buffer_; |
921 int index_; | 929 int index_; |
922 }; | 930 }; |
923 | 931 |
924 #define TRANSLATION_OPCODE_LIST(V) \ | 932 #define TRANSLATION_OPCODE_LIST(V) \ |
925 V(BEGIN) \ | 933 V(BEGIN) \ |
926 V(JS_FRAME) \ | 934 V(JS_FRAME) \ |
927 V(INTERPRETED_FRAME) \ | 935 V(INTERPRETED_FRAME) \ |
928 V(CONSTRUCT_STUB_FRAME) \ | 936 V(BUILTIN_CONTINUATION_FRAME) \ |
929 V(GETTER_STUB_FRAME) \ | 937 V(JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME) \ |
930 V(SETTER_STUB_FRAME) \ | 938 V(CONSTRUCT_STUB_FRAME) \ |
931 V(ARGUMENTS_ADAPTOR_FRAME) \ | 939 V(GETTER_STUB_FRAME) \ |
932 V(TAIL_CALLER_FRAME) \ | 940 V(SETTER_STUB_FRAME) \ |
933 V(COMPILED_STUB_FRAME) \ | 941 V(ARGUMENTS_ADAPTOR_FRAME) \ |
934 V(DUPLICATED_OBJECT) \ | 942 V(TAIL_CALLER_FRAME) \ |
935 V(ARGUMENTS_OBJECT) \ | 943 V(COMPILED_STUB_FRAME) \ |
936 V(ARGUMENTS_ELEMENTS) \ | 944 V(DUPLICATED_OBJECT) \ |
937 V(ARGUMENTS_LENGTH) \ | 945 V(ARGUMENTS_OBJECT) \ |
938 V(CAPTURED_OBJECT) \ | 946 V(ARGUMENTS_ELEMENTS) \ |
939 V(REGISTER) \ | 947 V(ARGUMENTS_LENGTH) \ |
940 V(INT32_REGISTER) \ | 948 V(CAPTURED_OBJECT) \ |
941 V(UINT32_REGISTER) \ | 949 V(REGISTER) \ |
942 V(BOOL_REGISTER) \ | 950 V(INT32_REGISTER) \ |
943 V(FLOAT_REGISTER) \ | 951 V(UINT32_REGISTER) \ |
944 V(DOUBLE_REGISTER) \ | 952 V(BOOL_REGISTER) \ |
945 V(STACK_SLOT) \ | 953 V(FLOAT_REGISTER) \ |
946 V(INT32_STACK_SLOT) \ | 954 V(DOUBLE_REGISTER) \ |
947 V(UINT32_STACK_SLOT) \ | 955 V(STACK_SLOT) \ |
948 V(BOOL_STACK_SLOT) \ | 956 V(INT32_STACK_SLOT) \ |
949 V(FLOAT_STACK_SLOT) \ | 957 V(UINT32_STACK_SLOT) \ |
950 V(DOUBLE_STACK_SLOT) \ | 958 V(BOOL_STACK_SLOT) \ |
| 959 V(FLOAT_STACK_SLOT) \ |
| 960 V(DOUBLE_STACK_SLOT) \ |
951 V(LITERAL) | 961 V(LITERAL) |
952 | 962 |
953 class Translation BASE_EMBEDDED { | 963 class Translation BASE_EMBEDDED { |
954 public: | 964 public: |
955 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item, | 965 #define DECLARE_TRANSLATION_OPCODE_ENUM(item) item, |
956 enum Opcode { | 966 enum Opcode { |
957 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) | 967 TRANSLATION_OPCODE_LIST(DECLARE_TRANSLATION_OPCODE_ENUM) |
958 LAST = LITERAL | 968 LAST = LITERAL |
959 }; | 969 }; |
960 #undef DECLARE_TRANSLATION_OPCODE_ENUM | 970 #undef DECLARE_TRANSLATION_OPCODE_ENUM |
(...skipping 12 matching lines...) Expand all Loading... |
973 | 983 |
974 // Commands. | 984 // Commands. |
975 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 985 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
976 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, | 986 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
977 unsigned height); | 987 unsigned height); |
978 void BeginCompiledStubFrame(int height); | 988 void BeginCompiledStubFrame(int height); |
979 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 989 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
980 void BeginTailCallerFrame(int literal_id); | 990 void BeginTailCallerFrame(int literal_id); |
981 void BeginConstructStubFrame(BailoutId bailout_id, int literal_id, | 991 void BeginConstructStubFrame(BailoutId bailout_id, int literal_id, |
982 unsigned height); | 992 unsigned height); |
| 993 void BeginBuiltinContinuationFrame(BailoutId bailout_id, int literal_id, |
| 994 unsigned height); |
| 995 void BeginJavaScriptBuiltinContinuationFrame(BailoutId bailout_id, |
| 996 int literal_id, unsigned height); |
983 void BeginGetterStubFrame(int literal_id); | 997 void BeginGetterStubFrame(int literal_id); |
984 void BeginSetterStubFrame(int literal_id); | 998 void BeginSetterStubFrame(int literal_id); |
985 void BeginArgumentsObject(int args_length); | 999 void BeginArgumentsObject(int args_length); |
986 void ArgumentsElements(bool is_rest); | 1000 void ArgumentsElements(bool is_rest); |
987 void ArgumentsLength(bool is_rest); | 1001 void ArgumentsLength(bool is_rest); |
988 void BeginCapturedObject(int length); | 1002 void BeginCapturedObject(int length); |
989 void DuplicateObject(int object_index); | 1003 void DuplicateObject(int object_index); |
990 void StoreRegister(Register reg); | 1004 void StoreRegister(Register reg); |
991 void StoreInt32Register(Register reg); | 1005 void StoreInt32Register(Register reg); |
992 void StoreUint32Register(Register reg); | 1006 void StoreUint32Register(Register reg); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 std::vector<Handle<Object> > expression_stack_; | 1118 std::vector<Handle<Object> > expression_stack_; |
1105 int source_position_; | 1119 int source_position_; |
1106 | 1120 |
1107 friend class Deoptimizer; | 1121 friend class Deoptimizer; |
1108 }; | 1122 }; |
1109 | 1123 |
1110 } // namespace internal | 1124 } // namespace internal |
1111 } // namespace v8 | 1125 } // namespace v8 |
1112 | 1126 |
1113 #endif // V8_DEOPTIMIZER_H_ | 1127 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |