Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 | 111 |
| 112 class TranslatedFrame { | 112 class TranslatedFrame { |
| 113 public: | 113 public: |
| 114 enum Kind { | 114 enum Kind { |
| 115 kFunction, | 115 kFunction, |
| 116 kInterpretedFunction, | 116 kInterpretedFunction, |
| 117 kGetter, | 117 kGetter, |
| 118 kSetter, | 118 kSetter, |
| 119 kTailCallerFunction, | |
| 119 kArgumentsAdaptor, | 120 kArgumentsAdaptor, |
| 120 kConstructStub, | 121 kConstructStub, |
| 121 kCompiledStub, | 122 kCompiledStub, |
| 122 kInvalid | 123 kInvalid |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 int GetValueCount(); | 126 int GetValueCount(); |
| 126 | 127 |
| 127 Kind kind() const { return kind_; } | 128 Kind kind() const { return kind_; } |
| 128 BailoutId node_id() const { return node_id_; } | 129 BailoutId node_id() const { return node_id_; } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // Constructor static methods. | 180 // Constructor static methods. |
| 180 static TranslatedFrame JSFrame(BailoutId node_id, | 181 static TranslatedFrame JSFrame(BailoutId node_id, |
| 181 SharedFunctionInfo* shared_info, int height); | 182 SharedFunctionInfo* shared_info, int height); |
| 182 static TranslatedFrame InterpretedFrame(BailoutId bytecode_offset, | 183 static TranslatedFrame InterpretedFrame(BailoutId bytecode_offset, |
| 183 SharedFunctionInfo* shared_info, | 184 SharedFunctionInfo* shared_info, |
| 184 int height); | 185 int height); |
| 185 static TranslatedFrame AccessorFrame(Kind kind, | 186 static TranslatedFrame AccessorFrame(Kind kind, |
| 186 SharedFunctionInfo* shared_info); | 187 SharedFunctionInfo* shared_info); |
| 187 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, | 188 static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo* shared_info, |
| 188 int height); | 189 int height); |
| 190 static TranslatedFrame JSTailCallerFrame(SharedFunctionInfo* shared_info); | |
| 189 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info, | 191 static TranslatedFrame ConstructStubFrame(SharedFunctionInfo* shared_info, |
| 190 int height); | 192 int height); |
| 191 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { | 193 static TranslatedFrame CompiledStubFrame(int height, Isolate* isolate) { |
| 192 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); | 194 return TranslatedFrame(kCompiledStub, isolate, nullptr, height); |
| 193 } | 195 } |
| 194 static TranslatedFrame InvalidFrame() { | 196 static TranslatedFrame InvalidFrame() { |
| 195 return TranslatedFrame(kInvalid, nullptr); | 197 return TranslatedFrame(kInvalid, nullptr); |
| 196 } | 198 } |
| 197 | 199 |
| 198 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); | 200 static void AdvanceIterator(std::deque<TranslatedValue>::iterator* iter); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 522 BailoutId node_id, | 524 BailoutId node_id, |
| 523 SharedFunctionInfo* shared); | 525 SharedFunctionInfo* shared); |
| 524 | 526 |
| 525 // Code generation support. | 527 // Code generation support. |
| 526 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } | 528 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } |
| 527 static int output_count_offset() { | 529 static int output_count_offset() { |
| 528 return OFFSET_OF(Deoptimizer, output_count_); | 530 return OFFSET_OF(Deoptimizer, output_count_); |
| 529 } | 531 } |
| 530 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); } | 532 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); } |
| 531 | 533 |
| 534 static int caller_frame_top_offset() { | |
| 535 return OFFSET_OF(Deoptimizer, caller_frame_top_); | |
| 536 } | |
| 537 | |
| 532 static int GetDeoptimizedCodeCount(Isolate* isolate); | 538 static int GetDeoptimizedCodeCount(Isolate* isolate); |
| 533 | 539 |
| 534 static const int kNotDeoptimizationEntry = -1; | 540 static const int kNotDeoptimizationEntry = -1; |
| 535 | 541 |
| 536 // Generators for the deoptimization entry code. | 542 // Generators for the deoptimization entry code. |
| 537 class TableEntryGenerator BASE_EMBEDDED { | 543 class TableEntryGenerator BASE_EMBEDDED { |
| 538 public: | 544 public: |
| 539 TableEntryGenerator(MacroAssembler* masm, BailoutType type, int count) | 545 TableEntryGenerator(MacroAssembler* masm, BailoutType type, int count) |
| 540 : masm_(masm), type_(type), count_(count) {} | 546 : masm_(masm), type_(type), count_(count) {} |
| 541 | 547 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 BailoutType type, | 581 BailoutType type, |
| 576 unsigned bailout_id, | 582 unsigned bailout_id, |
| 577 Address from, | 583 Address from, |
| 578 int fp_to_sp_delta, | 584 int fp_to_sp_delta, |
| 579 Code* optimized_code); | 585 Code* optimized_code); |
| 580 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); | 586 Code* FindOptimizedCode(JSFunction* function, Code* optimized_code); |
| 581 void PrintFunctionName(); | 587 void PrintFunctionName(); |
| 582 void DeleteFrameDescriptions(); | 588 void DeleteFrameDescriptions(); |
| 583 | 589 |
| 584 void DoComputeOutputFrames(); | 590 void DoComputeOutputFrames(); |
| 585 void DoComputeJSFrame(int frame_index, bool goto_catch_handler); | 591 void DoComputeJSFrame(TranslatedFrame* translated_frame, int frame_index, |
| 586 void DoComputeInterpretedFrame(int frame_index, bool goto_catch_handler); | 592 bool goto_catch_handler); |
| 587 void DoComputeArgumentsAdaptorFrame(int frame_index); | 593 void DoComputeInterpretedFrame(TranslatedFrame* translated_frame, |
| 588 void DoComputeConstructStubFrame(int frame_index); | 594 int frame_index, bool goto_catch_handler); |
| 589 void DoComputeAccessorStubFrame(int frame_index, bool is_setter_stub_frame); | 595 void DoComputeArgumentsAdaptorFrame(TranslatedFrame* translated_frame, |
| 590 void DoComputeCompiledStubFrame(int frame_index); | 596 int frame_index); |
| 597 void DoComputeTailCallerFrame(TranslatedFrame* translated_frame, | |
| 598 int frame_index); | |
| 599 void DoComputeConstructStubFrame(TranslatedFrame* translated_frame, | |
| 600 int frame_index); | |
| 601 void DoComputeAccessorStubFrame(TranslatedFrame* translated_frame, | |
| 602 int frame_index, bool is_setter_stub_frame); | |
| 603 void DoComputeCompiledStubFrame(TranslatedFrame* translated_frame, | |
| 604 int frame_index); | |
| 591 | 605 |
| 592 void WriteTranslatedValueToOutput( | 606 void WriteTranslatedValueToOutput( |
| 593 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, | 607 TranslatedFrame::iterator* iterator, int* input_index, int frame_index, |
| 594 unsigned output_offset, const char* debug_hint_string = nullptr, | 608 unsigned output_offset, const char* debug_hint_string = nullptr, |
| 595 Address output_address_for_materialization = nullptr); | 609 Address output_address_for_materialization = nullptr); |
| 596 void WriteValueToOutput(Object* value, int input_index, int frame_index, | 610 void WriteValueToOutput(Object* value, int input_index, int frame_index, |
| 597 unsigned output_offset, | 611 unsigned output_offset, |
| 598 const char* debug_hint_string); | 612 const char* debug_hint_string); |
| 599 void DebugPrintOutputSlot(intptr_t value, int frame_index, | 613 void DebugPrintOutputSlot(intptr_t value, int frame_index, |
| 600 unsigned output_offset, | 614 unsigned output_offset, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 }; | 942 }; |
| 929 | 943 |
| 930 #define TRANSLATION_OPCODE_LIST(V) \ | 944 #define TRANSLATION_OPCODE_LIST(V) \ |
| 931 V(BEGIN) \ | 945 V(BEGIN) \ |
| 932 V(JS_FRAME) \ | 946 V(JS_FRAME) \ |
| 933 V(INTERPRETED_FRAME) \ | 947 V(INTERPRETED_FRAME) \ |
| 934 V(CONSTRUCT_STUB_FRAME) \ | 948 V(CONSTRUCT_STUB_FRAME) \ |
| 935 V(GETTER_STUB_FRAME) \ | 949 V(GETTER_STUB_FRAME) \ |
| 936 V(SETTER_STUB_FRAME) \ | 950 V(SETTER_STUB_FRAME) \ |
| 937 V(ARGUMENTS_ADAPTOR_FRAME) \ | 951 V(ARGUMENTS_ADAPTOR_FRAME) \ |
| 952 V(JS_TAIL_CALLER_FRAME) \ | |
|
Michael Starzinger
2016/03/08 16:25:08
nit: Can we call this "TAIL_CALLER_FRAME" without
Igor Sheludko
2016/03/08 18:03:40
Done.
| |
| 938 V(COMPILED_STUB_FRAME) \ | 953 V(COMPILED_STUB_FRAME) \ |
| 939 V(DUPLICATED_OBJECT) \ | 954 V(DUPLICATED_OBJECT) \ |
| 940 V(ARGUMENTS_OBJECT) \ | 955 V(ARGUMENTS_OBJECT) \ |
| 941 V(CAPTURED_OBJECT) \ | 956 V(CAPTURED_OBJECT) \ |
| 942 V(REGISTER) \ | 957 V(REGISTER) \ |
| 943 V(INT32_REGISTER) \ | 958 V(INT32_REGISTER) \ |
| 944 V(UINT32_REGISTER) \ | 959 V(UINT32_REGISTER) \ |
| 945 V(BOOL_REGISTER) \ | 960 V(BOOL_REGISTER) \ |
| 946 V(DOUBLE_REGISTER) \ | 961 V(DOUBLE_REGISTER) \ |
| 947 V(STACK_SLOT) \ | 962 V(STACK_SLOT) \ |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 971 } | 986 } |
| 972 | 987 |
| 973 int index() const { return index_; } | 988 int index() const { return index_; } |
| 974 | 989 |
| 975 // Commands. | 990 // Commands. |
| 976 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); | 991 void BeginJSFrame(BailoutId node_id, int literal_id, unsigned height); |
| 977 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, | 992 void BeginInterpretedFrame(BailoutId bytecode_offset, int literal_id, |
| 978 unsigned height); | 993 unsigned height); |
| 979 void BeginCompiledStubFrame(int height); | 994 void BeginCompiledStubFrame(int height); |
| 980 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); | 995 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
| 996 void BeginTailCallerFrame(int literal_id); | |
| 981 void BeginConstructStubFrame(int literal_id, unsigned height); | 997 void BeginConstructStubFrame(int literal_id, unsigned height); |
| 982 void BeginGetterStubFrame(int literal_id); | 998 void BeginGetterStubFrame(int literal_id); |
| 983 void BeginSetterStubFrame(int literal_id); | 999 void BeginSetterStubFrame(int literal_id); |
| 984 void BeginArgumentsObject(int args_length); | 1000 void BeginArgumentsObject(int args_length); |
| 985 void BeginCapturedObject(int length); | 1001 void BeginCapturedObject(int length); |
| 986 void DuplicateObject(int object_index); | 1002 void DuplicateObject(int object_index); |
| 987 void StoreRegister(Register reg); | 1003 void StoreRegister(Register reg); |
| 988 void StoreInt32Register(Register reg); | 1004 void StoreInt32Register(Register reg); |
| 989 void StoreUint32Register(Register reg); | 1005 void StoreUint32Register(Register reg); |
| 990 void StoreBoolRegister(Register reg); | 1006 void StoreBoolRegister(Register reg); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1099 std::vector<Handle<Object> > expression_stack_; | 1115 std::vector<Handle<Object> > expression_stack_; |
| 1100 int source_position_; | 1116 int source_position_; |
| 1101 | 1117 |
| 1102 friend class Deoptimizer; | 1118 friend class Deoptimizer; |
| 1103 }; | 1119 }; |
| 1104 | 1120 |
| 1105 } // namespace internal | 1121 } // namespace internal |
| 1106 } // namespace v8 | 1122 } // namespace v8 |
| 1107 | 1123 |
| 1108 #endif // V8_DEOPTIMIZER_H_ | 1124 #endif // V8_DEOPTIMIZER_H_ |
| OLD | NEW |