OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 int jsframe_count() const { return jsframe_count_; } | 162 int jsframe_count() const { return jsframe_count_; } |
163 | 163 |
164 static Deoptimizer* New(JSFunction* function, | 164 static Deoptimizer* New(JSFunction* function, |
165 BailoutType type, | 165 BailoutType type, |
166 unsigned bailout_id, | 166 unsigned bailout_id, |
167 Address from, | 167 Address from, |
168 int fp_to_sp_delta, | 168 int fp_to_sp_delta, |
169 Isolate* isolate); | 169 Isolate* isolate); |
170 static Deoptimizer* Grab(Isolate* isolate); | 170 static Deoptimizer* Grab(Isolate* isolate); |
171 | 171 |
172 #ifdef ENABLE_DEBUGGER_SUPPORT | |
173 // The returned object with information on the optimized frame needs to be | 172 // The returned object with information on the optimized frame needs to be |
174 // freed before another one can be generated. | 173 // freed before another one can be generated. |
175 static DeoptimizedFrameInfo* DebuggerInspectableFrame(JavaScriptFrame* frame, | 174 static DeoptimizedFrameInfo* DebuggerInspectableFrame(JavaScriptFrame* frame, |
176 int jsframe_index, | 175 int jsframe_index, |
177 Isolate* isolate); | 176 Isolate* isolate); |
178 static void DeleteDebuggerInspectableFrame(DeoptimizedFrameInfo* info, | 177 static void DeleteDebuggerInspectableFrame(DeoptimizedFrameInfo* info, |
179 Isolate* isolate); | 178 Isolate* isolate); |
180 #endif | |
181 | 179 |
182 // Makes sure that there is enough room in the relocation | 180 // Makes sure that there is enough room in the relocation |
183 // information of a code object to perform lazy deoptimization | 181 // information of a code object to perform lazy deoptimization |
184 // patching. If there is not enough room a new relocation | 182 // patching. If there is not enough room a new relocation |
185 // information object is allocated and comments are added until it | 183 // information object is allocated and comments are added until it |
186 // is big enough. | 184 // is big enough. |
187 static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code); | 185 static void EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code); |
188 | 186 |
189 // Deoptimize the function now. Its current optimized code will never be run | 187 // Deoptimize the function now. Its current optimized code will never be run |
190 // again and any activations of the optimized code will get deoptimized when | 188 // again and any activations of the optimized code will get deoptimized when |
(...skipping 14 matching lines...) Expand all Loading... |
205 // Visit all the known optimized functions in a given isolate. | 203 // Visit all the known optimized functions in a given isolate. |
206 static void VisitAllOptimizedFunctions( | 204 static void VisitAllOptimizedFunctions( |
207 Isolate* isolate, OptimizedFunctionVisitor* visitor); | 205 Isolate* isolate, OptimizedFunctionVisitor* visitor); |
208 | 206 |
209 // The size in bytes of the code required at a lazy deopt patch site. | 207 // The size in bytes of the code required at a lazy deopt patch site. |
210 static int patch_size(); | 208 static int patch_size(); |
211 | 209 |
212 ~Deoptimizer(); | 210 ~Deoptimizer(); |
213 | 211 |
214 void MaterializeHeapObjects(JavaScriptFrameIterator* it); | 212 void MaterializeHeapObjects(JavaScriptFrameIterator* it); |
215 #ifdef ENABLE_DEBUGGER_SUPPORT | 213 |
216 void MaterializeHeapNumbersForDebuggerInspectableFrame( | 214 void MaterializeHeapNumbersForDebuggerInspectableFrame( |
217 Address parameters_top, | 215 Address parameters_top, |
218 uint32_t parameters_size, | 216 uint32_t parameters_size, |
219 Address expressions_top, | 217 Address expressions_top, |
220 uint32_t expressions_size, | 218 uint32_t expressions_size, |
221 DeoptimizedFrameInfo* info); | 219 DeoptimizedFrameInfo* info); |
222 #endif | |
223 | 220 |
224 static void ComputeOutputFrames(Deoptimizer* deoptimizer); | 221 static void ComputeOutputFrames(Deoptimizer* deoptimizer); |
225 | 222 |
226 | 223 |
227 enum GetEntryMode { | 224 enum GetEntryMode { |
228 CALCULATE_ENTRY_ADDRESS, | 225 CALCULATE_ENTRY_ADDRESS, |
229 ENSURE_ENTRY_CODE | 226 ENSURE_ENTRY_CODE |
230 }; | 227 }; |
231 | 228 |
232 | 229 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 634 |
638 int ComputeFixedSize(); | 635 int ComputeFixedSize(); |
639 }; | 636 }; |
640 | 637 |
641 | 638 |
642 class DeoptimizerData { | 639 class DeoptimizerData { |
643 public: | 640 public: |
644 explicit DeoptimizerData(MemoryAllocator* allocator); | 641 explicit DeoptimizerData(MemoryAllocator* allocator); |
645 ~DeoptimizerData(); | 642 ~DeoptimizerData(); |
646 | 643 |
647 #ifdef ENABLE_DEBUGGER_SUPPORT | |
648 void Iterate(ObjectVisitor* v); | 644 void Iterate(ObjectVisitor* v); |
649 #endif | |
650 | 645 |
651 private: | 646 private: |
652 MemoryAllocator* allocator_; | 647 MemoryAllocator* allocator_; |
653 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 648 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry]; |
654 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 649 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry]; |
655 | 650 |
656 #ifdef ENABLE_DEBUGGER_SUPPORT | |
657 DeoptimizedFrameInfo* deoptimized_frame_info_; | 651 DeoptimizedFrameInfo* deoptimized_frame_info_; |
658 #endif | |
659 | 652 |
660 Deoptimizer* current_; | 653 Deoptimizer* current_; |
661 | 654 |
662 friend class Deoptimizer; | 655 friend class Deoptimizer; |
663 | 656 |
664 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); | 657 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); |
665 }; | 658 }; |
666 | 659 |
667 | 660 |
668 class TranslationBuffer BASE_EMBEDDED { | 661 class TranslationBuffer BASE_EMBEDDED { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 Handle<FixedArray> GetStackEntries(); | 905 Handle<FixedArray> GetStackEntries(); |
913 Handle<FixedArray> EnsureStackEntries(int size); | 906 Handle<FixedArray> EnsureStackEntries(int size); |
914 | 907 |
915 int StackIdToIndex(Address fp); | 908 int StackIdToIndex(Address fp); |
916 | 909 |
917 Isolate* isolate_; | 910 Isolate* isolate_; |
918 List<Address> frame_fps_; | 911 List<Address> frame_fps_; |
919 }; | 912 }; |
920 | 913 |
921 | 914 |
922 #ifdef ENABLE_DEBUGGER_SUPPORT | |
923 // Class used to represent an unoptimized frame when the debugger | 915 // Class used to represent an unoptimized frame when the debugger |
924 // needs to inspect a frame that is part of an optimized frame. The | 916 // needs to inspect a frame that is part of an optimized frame. The |
925 // internally used FrameDescription objects are not GC safe so for use | 917 // internally used FrameDescription objects are not GC safe so for use |
926 // by the debugger frame information is copied to an object of this type. | 918 // by the debugger frame information is copied to an object of this type. |
927 // Represents parameters in unadapted form so their number might mismatch | 919 // Represents parameters in unadapted form so their number might mismatch |
928 // formal parameter count. | 920 // formal parameter count. |
929 class DeoptimizedFrameInfo : public Malloced { | 921 class DeoptimizedFrameInfo : public Malloced { |
930 public: | 922 public: |
931 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, | 923 DeoptimizedFrameInfo(Deoptimizer* deoptimizer, |
932 int frame_index, | 924 int frame_index, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 JSFunction* function_; | 978 JSFunction* function_; |
987 bool has_construct_stub_; | 979 bool has_construct_stub_; |
988 int parameters_count_; | 980 int parameters_count_; |
989 int expression_count_; | 981 int expression_count_; |
990 Object** parameters_; | 982 Object** parameters_; |
991 Object** expression_stack_; | 983 Object** expression_stack_; |
992 int source_position_; | 984 int source_position_; |
993 | 985 |
994 friend class Deoptimizer; | 986 friend class Deoptimizer; |
995 }; | 987 }; |
996 #endif | |
997 | 988 |
998 } } // namespace v8::internal | 989 } } // namespace v8::internal |
999 | 990 |
1000 #endif // V8_DEOPTIMIZER_H_ | 991 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |