OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 class DeoptimizerData { | 79 class DeoptimizerData { |
80 public: | 80 public: |
81 DeoptimizerData(); | 81 DeoptimizerData(); |
82 ~DeoptimizerData(); | 82 ~DeoptimizerData(); |
83 | 83 |
84 #ifdef ENABLE_DEBUGGER_SUPPORT | 84 #ifdef ENABLE_DEBUGGER_SUPPORT |
85 void Iterate(ObjectVisitor* v); | 85 void Iterate(ObjectVisitor* v); |
86 #endif | 86 #endif |
87 | 87 |
88 private: | 88 private: |
89 LargeObjectChunk* eager_deoptimization_entry_code_; | 89 MemoryChunk* eager_deoptimization_entry_code_; |
90 LargeObjectChunk* lazy_deoptimization_entry_code_; | 90 MemoryChunk* lazy_deoptimization_entry_code_; |
91 Deoptimizer* current_; | 91 Deoptimizer* current_; |
92 | 92 |
93 #ifdef ENABLE_DEBUGGER_SUPPORT | 93 #ifdef ENABLE_DEBUGGER_SUPPORT |
94 DeoptimizedFrameInfo* deoptimized_frame_info_; | 94 DeoptimizedFrameInfo* deoptimized_frame_info_; |
95 #endif | 95 #endif |
96 | 96 |
97 // List of deoptimized code which still have references from active stack | 97 // List of deoptimized code which still have references from active stack |
98 // frames. These code objects are needed by the deoptimizer when deoptimizing | 98 // frames. These code objects are needed by the deoptimizer when deoptimizing |
99 // a frame for which the code object for the function function has been | 99 // a frame for which the code object for the function function has been |
100 // changed from the code present when deoptimizing was done. | 100 // changed from the code present when deoptimizing was done. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 static int patch_size(); | 166 static int patch_size(); |
167 | 167 |
168 // Patch all stack guard checks in the unoptimized code to | 168 // Patch all stack guard checks in the unoptimized code to |
169 // unconditionally call replacement_code. | 169 // unconditionally call replacement_code. |
170 static void PatchStackCheckCode(Code* unoptimized_code, | 170 static void PatchStackCheckCode(Code* unoptimized_code, |
171 Code* check_code, | 171 Code* check_code, |
172 Code* replacement_code); | 172 Code* replacement_code); |
173 | 173 |
174 // Patch stack guard check at instruction before pc_after in | 174 // Patch stack guard check at instruction before pc_after in |
175 // the unoptimized code to unconditionally call replacement_code. | 175 // the unoptimized code to unconditionally call replacement_code. |
176 static void PatchStackCheckCodeAt(Address pc_after, | 176 static void PatchStackCheckCodeAt(Code* unoptimized_code, |
| 177 Address pc_after, |
177 Code* check_code, | 178 Code* check_code, |
178 Code* replacement_code); | 179 Code* replacement_code); |
179 | 180 |
180 // Change all patched stack guard checks in the unoptimized code | 181 // Change all patched stack guard checks in the unoptimized code |
181 // back to a normal stack guard check. | 182 // back to a normal stack guard check. |
182 static void RevertStackCheckCode(Code* unoptimized_code, | 183 static void RevertStackCheckCode(Code* unoptimized_code, |
183 Code* check_code, | 184 Code* check_code, |
184 Code* replacement_code); | 185 Code* replacement_code); |
185 | 186 |
186 // Change all patched stack guard checks in the unoptimized code | 187 // Change all patched stack guard checks in the unoptimized code |
(...skipping 17 matching lines...) Expand all Loading... |
204 static int GetOutputInfo(DeoptimizationOutputData* data, | 205 static int GetOutputInfo(DeoptimizationOutputData* data, |
205 unsigned node_id, | 206 unsigned node_id, |
206 SharedFunctionInfo* shared); | 207 SharedFunctionInfo* shared); |
207 | 208 |
208 // Code generation support. | 209 // Code generation support. |
209 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } | 210 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } |
210 static int output_count_offset() { | 211 static int output_count_offset() { |
211 return OFFSET_OF(Deoptimizer, output_count_); | 212 return OFFSET_OF(Deoptimizer, output_count_); |
212 } | 213 } |
213 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); } | 214 static int output_offset() { return OFFSET_OF(Deoptimizer, output_); } |
| 215 static int frame_alignment_marker_offset() { |
| 216 return OFFSET_OF(Deoptimizer, frame_alignment_marker_); } |
| 217 static int has_alignment_padding_offset() { |
| 218 return OFFSET_OF(Deoptimizer, has_alignment_padding_); |
| 219 } |
214 | 220 |
215 static int GetDeoptimizedCodeCount(Isolate* isolate); | 221 static int GetDeoptimizedCodeCount(Isolate* isolate); |
216 | 222 |
217 static const int kNotDeoptimizationEntry = -1; | 223 static const int kNotDeoptimizationEntry = -1; |
218 | 224 |
219 // Generators for the deoptimization entry code. | 225 // Generators for the deoptimization entry code. |
220 class EntryGenerator BASE_EMBEDDED { | 226 class EntryGenerator BASE_EMBEDDED { |
221 public: | 227 public: |
222 EntryGenerator(MacroAssembler* masm, BailoutType type) | 228 EntryGenerator(MacroAssembler* masm, BailoutType type) |
223 : masm_(masm), type_(type) { } | 229 : masm_(masm), type_(type) { } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 unsigned ComputeInputFrameSize() const; | 284 unsigned ComputeInputFrameSize() const; |
279 unsigned ComputeFixedSize(JSFunction* function) const; | 285 unsigned ComputeFixedSize(JSFunction* function) const; |
280 | 286 |
281 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 287 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
282 unsigned ComputeOutgoingArgumentSize() const; | 288 unsigned ComputeOutgoingArgumentSize() const; |
283 | 289 |
284 Object* ComputeLiteral(int index) const; | 290 Object* ComputeLiteral(int index) const; |
285 | 291 |
286 void AddDoubleValue(intptr_t slot_address, double value); | 292 void AddDoubleValue(intptr_t slot_address, double value); |
287 | 293 |
288 static LargeObjectChunk* CreateCode(BailoutType type); | 294 static MemoryChunk* CreateCode(BailoutType type); |
289 static void GenerateDeoptimizationEntries( | 295 static void GenerateDeoptimizationEntries( |
290 MacroAssembler* masm, int count, BailoutType type); | 296 MacroAssembler* masm, int count, BailoutType type); |
291 | 297 |
292 // Weak handle callback for deoptimizing code objects. | 298 // Weak handle callback for deoptimizing code objects. |
293 static void HandleWeakDeoptimizedCode( | 299 static void HandleWeakDeoptimizedCode( |
294 v8::Persistent<v8::Value> obj, void* data); | 300 v8::Persistent<v8::Value> obj, void* data); |
295 static Code* FindDeoptimizingCodeFromAddress(Address addr); | 301 static Code* FindDeoptimizingCodeFromAddress(Address addr); |
296 static void RemoveDeoptimizingCode(Code* code); | 302 static void RemoveDeoptimizingCode(Code* code); |
297 | 303 |
298 // Fill the input from from a JavaScript frame. This is used when | 304 // Fill the input from from a JavaScript frame. This is used when |
299 // the debugger needs to inspect an optimized frame. For normal | 305 // the debugger needs to inspect an optimized frame. For normal |
300 // deoptimizations the input frame is filled in generated code. | 306 // deoptimizations the input frame is filled in generated code. |
301 void FillInputFrame(Address tos, JavaScriptFrame* frame); | 307 void FillInputFrame(Address tos, JavaScriptFrame* frame); |
302 | 308 |
303 Isolate* isolate_; | 309 Isolate* isolate_; |
304 JSFunction* function_; | 310 JSFunction* function_; |
305 Code* optimized_code_; | 311 Code* optimized_code_; |
306 unsigned bailout_id_; | 312 unsigned bailout_id_; |
307 BailoutType bailout_type_; | 313 BailoutType bailout_type_; |
308 Address from_; | 314 Address from_; |
309 int fp_to_sp_delta_; | 315 int fp_to_sp_delta_; |
310 | 316 |
311 // Input frame description. | 317 // Input frame description. |
312 FrameDescription* input_; | 318 FrameDescription* input_; |
313 // Number of output frames. | 319 // Number of output frames. |
314 int output_count_; | 320 int output_count_; |
315 // Array of output frame descriptions. | 321 // Array of output frame descriptions. |
316 FrameDescription** output_; | 322 FrameDescription** output_; |
317 | 323 |
| 324 // Frames can be dynamically padded on ia32 to align untagged doubles. |
| 325 Object* frame_alignment_marker_; |
| 326 intptr_t has_alignment_padding_; |
| 327 |
318 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; | 328 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; |
319 | 329 |
320 static const int table_entry_size_; | 330 static const int table_entry_size_; |
321 | 331 |
322 friend class FrameDescription; | 332 friend class FrameDescription; |
323 friend class DeoptimizingCodeListNode; | 333 friend class DeoptimizingCodeListNode; |
324 friend class DeoptimizedFrameInfo; | 334 friend class DeoptimizedFrameInfo; |
325 }; | 335 }; |
326 | 336 |
327 | 337 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 Object** parameters_; | 727 Object** parameters_; |
718 Object** expression_stack_; | 728 Object** expression_stack_; |
719 | 729 |
720 friend class Deoptimizer; | 730 friend class Deoptimizer; |
721 }; | 731 }; |
722 #endif | 732 #endif |
723 | 733 |
724 } } // namespace v8::internal | 734 } } // namespace v8::internal |
725 | 735 |
726 #endif // V8_DEOPTIMIZER_H_ | 736 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |