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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 | 900 |
901 int ComputeFixedSize(); | 901 int ComputeFixedSize(); |
902 }; | 902 }; |
903 | 903 |
904 | 904 |
905 class DeoptimizerData { | 905 class DeoptimizerData { |
906 public: | 906 public: |
907 explicit DeoptimizerData(MemoryAllocator* allocator); | 907 explicit DeoptimizerData(MemoryAllocator* allocator); |
908 ~DeoptimizerData(); | 908 ~DeoptimizerData(); |
909 | 909 |
910 void Iterate(ObjectVisitor* v); | |
911 | |
912 private: | 910 private: |
913 MemoryAllocator* allocator_; | 911 MemoryAllocator* allocator_; |
914 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 912 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry]; |
915 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 913 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry]; |
916 | 914 |
917 DeoptimizedFrameInfo* deoptimized_frame_info_; | |
918 | |
919 Deoptimizer* current_; | 915 Deoptimizer* current_; |
920 | 916 |
921 friend class Deoptimizer; | 917 friend class Deoptimizer; |
922 | 918 |
923 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); | 919 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); |
924 }; | 920 }; |
925 | 921 |
926 | 922 |
927 class TranslationBuffer BASE_EMBEDDED { | 923 class TranslationBuffer BASE_EMBEDDED { |
928 public: | 924 public: |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 // internally used FrameDescription objects are not GC safe so for use | 1066 // internally used FrameDescription objects are not GC safe so for use |
1071 // by the debugger frame information is copied to an object of this type. | 1067 // by the debugger frame information is copied to an object of this type. |
1072 // Represents parameters in unadapted form so their number might mismatch | 1068 // Represents parameters in unadapted form so their number might mismatch |
1073 // formal parameter count. | 1069 // formal parameter count. |
1074 class DeoptimizedFrameInfo : public Malloced { | 1070 class DeoptimizedFrameInfo : public Malloced { |
1075 public: | 1071 public: |
1076 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, | 1072 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, |
1077 int frame_index, | 1073 int frame_index, |
1078 bool has_arguments_adaptor, | 1074 bool has_arguments_adaptor, |
1079 bool has_construct_stub); | 1075 bool has_construct_stub); |
1080 virtual ~DeoptimizedFrameInfo(); | |
1081 | |
1082 // GC support. | |
1083 void Iterate(ObjectVisitor* v); | |
1084 | |
1085 // Return the number of incoming arguments. | 1076 // Return the number of incoming arguments. |
1086 int parameters_count() { return parameters_count_; } | 1077 int parameters_count() { return static_cast<int>(parameters_.size()); } |
1087 | 1078 |
1088 // Return the height of the expression stack. | 1079 // Return the height of the expression stack. |
1089 int expression_count() { return expression_count_; } | 1080 int expression_count() { return static_cast<int>(expression_stack_.size()); } |
1090 | 1081 |
1091 // Get the frame function. | 1082 // Get the frame function. |
1092 JSFunction* GetFunction() { | 1083 Handle<JSFunction> GetFunction() { return function_; } |
1093 return function_; | |
1094 } | |
1095 | 1084 |
1096 // Get the frame context. | 1085 // Get the frame context. |
1097 Object* GetContext() { return context_; } | 1086 Handle<Object> GetContext() { return context_; } |
1098 | 1087 |
1099 // Check if this frame is preceded by construct stub frame. The bottom-most | 1088 // Check if this frame is preceded by construct stub frame. The bottom-most |
1100 // inlined frame might still be called by an uninlined construct stub. | 1089 // inlined frame might still be called by an uninlined construct stub. |
1101 bool HasConstructStub() { | 1090 bool HasConstructStub() { |
1102 return has_construct_stub_; | 1091 return has_construct_stub_; |
1103 } | 1092 } |
1104 | 1093 |
1105 // Get an incoming argument. | 1094 // Get an incoming argument. |
1106 Object* GetParameter(int index) { | 1095 Handle<Object> GetParameter(int index) { |
1107 DCHECK(0 <= index && index < parameters_count()); | 1096 DCHECK(0 <= index && index < parameters_count()); |
1108 return parameters_[index]; | 1097 return parameters_[index]; |
1109 } | 1098 } |
1110 | 1099 |
1111 // Get an expression from the expression stack. | 1100 // Get an expression from the expression stack. |
1112 Object* GetExpression(int index) { | 1101 Handle<Object> GetExpression(int index) { |
1113 DCHECK(0 <= index && index < expression_count()); | 1102 DCHECK(0 <= index && index < expression_count()); |
1114 return expression_stack_[index]; | 1103 return expression_stack_[index]; |
1115 } | 1104 } |
1116 | 1105 |
1117 int GetSourcePosition() { | 1106 int GetSourcePosition() { |
1118 return source_position_; | 1107 return source_position_; |
1119 } | 1108 } |
1120 | 1109 |
1121 private: | 1110 private: |
1122 // Set an incoming argument. | 1111 // Set an incoming argument. |
1123 void SetParameter(int index, Object* obj) { | 1112 void SetParameter(int index, Handle<Object> obj) { |
1124 DCHECK(0 <= index && index < parameters_count()); | 1113 DCHECK(0 <= index && index < parameters_count()); |
1125 parameters_[index] = obj; | 1114 parameters_[index] = obj; |
1126 } | 1115 } |
1127 | 1116 |
1128 // Set an expression on the expression stack. | 1117 // Set an expression on the expression stack. |
1129 void SetExpression(int index, Object* obj) { | 1118 void SetExpression(int index, Handle<Object> obj) { |
1130 DCHECK(0 <= index && index < expression_count()); | 1119 DCHECK(0 <= index && index < expression_count()); |
1131 expression_stack_[index] = obj; | 1120 expression_stack_[index] = obj; |
1132 } | 1121 } |
1133 | 1122 |
1134 JSFunction* function_; | 1123 Handle<JSFunction> function_; |
1135 Object* context_; | 1124 Handle<Object> context_; |
1136 bool has_construct_stub_; | 1125 bool has_construct_stub_; |
1137 int parameters_count_; | 1126 std::vector<Handle<Object> > parameters_; |
1138 int expression_count_; | 1127 std::vector<Handle<Object> > expression_stack_; |
1139 Object** parameters_; | |
1140 Object** expression_stack_; | |
1141 int source_position_; | 1128 int source_position_; |
1142 | 1129 |
1143 friend class Deoptimizer; | 1130 friend class Deoptimizer; |
1144 }; | 1131 }; |
1145 | 1132 |
1146 } // namespace internal | 1133 } // namespace internal |
1147 } // namespace v8 | 1134 } // namespace v8 |
1148 | 1135 |
1149 #endif // V8_DEOPTIMIZER_H_ | 1136 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |