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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 class DeoptimizerData { | 93 class DeoptimizerData { |
94 public: | 94 public: |
95 DeoptimizerData(); | 95 DeoptimizerData(); |
96 ~DeoptimizerData(); | 96 ~DeoptimizerData(); |
97 | 97 |
98 #ifdef ENABLE_DEBUGGER_SUPPORT | 98 #ifdef ENABLE_DEBUGGER_SUPPORT |
99 void Iterate(ObjectVisitor* v); | 99 void Iterate(ObjectVisitor* v); |
100 #endif | 100 #endif |
101 | 101 |
102 private: | 102 private: |
103 MemoryChunk* eager_deoptimization_entry_code_; | 103 int eager_deoptimization_entry_code_entries_; |
104 MemoryChunk* lazy_deoptimization_entry_code_; | 104 int lazy_deoptimization_entry_code_entries_; |
| 105 VirtualMemory* eager_deoptimization_entry_code_; |
| 106 VirtualMemory* lazy_deoptimization_entry_code_; |
105 Deoptimizer* current_; | 107 Deoptimizer* current_; |
106 | 108 |
107 #ifdef ENABLE_DEBUGGER_SUPPORT | 109 #ifdef ENABLE_DEBUGGER_SUPPORT |
108 DeoptimizedFrameInfo* deoptimized_frame_info_; | 110 DeoptimizedFrameInfo* deoptimized_frame_info_; |
109 #endif | 111 #endif |
110 | 112 |
111 // List of deoptimized code which still have references from active stack | 113 // List of deoptimized code which still have references from active stack |
112 // frames. These code objects are needed by the deoptimizer when deoptimizing | 114 // frames. These code objects are needed by the deoptimizer when deoptimizing |
113 // a frame for which the code object for the function function has been | 115 // a frame for which the code object for the function function has been |
114 // changed from the code present when deoptimizing was done. | 116 // changed from the code present when deoptimizing was done. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void MaterializeHeapNumbersForDebuggerInspectableFrame( | 221 void MaterializeHeapNumbersForDebuggerInspectableFrame( |
220 Address parameters_top, | 222 Address parameters_top, |
221 uint32_t parameters_size, | 223 uint32_t parameters_size, |
222 Address expressions_top, | 224 Address expressions_top, |
223 uint32_t expressions_size, | 225 uint32_t expressions_size, |
224 DeoptimizedFrameInfo* info); | 226 DeoptimizedFrameInfo* info); |
225 #endif | 227 #endif |
226 | 228 |
227 static void ComputeOutputFrames(Deoptimizer* deoptimizer); | 229 static void ComputeOutputFrames(Deoptimizer* deoptimizer); |
228 | 230 |
229 static Address GetDeoptimizationEntry(int id, BailoutType type); | 231 |
| 232 enum GetEntryMode { |
| 233 CALCULATE_ENTRY_ADDRESS, |
| 234 ENSURE_ENTRY_CODE |
| 235 }; |
| 236 |
| 237 |
| 238 static Address GetDeoptimizationEntry( |
| 239 int id, |
| 240 BailoutType type, |
| 241 GetEntryMode mode = ENSURE_ENTRY_CODE); |
230 static int GetDeoptimizationId(Address addr, BailoutType type); | 242 static int GetDeoptimizationId(Address addr, BailoutType type); |
231 static int GetOutputInfo(DeoptimizationOutputData* data, | 243 static int GetOutputInfo(DeoptimizationOutputData* data, |
232 BailoutId node_id, | 244 BailoutId node_id, |
233 SharedFunctionInfo* shared); | 245 SharedFunctionInfo* shared); |
234 | 246 |
235 // Code generation support. | 247 // Code generation support. |
236 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } | 248 static int input_offset() { return OFFSET_OF(Deoptimizer, input_); } |
237 static int output_count_offset() { | 249 static int output_count_offset() { |
238 return OFFSET_OF(Deoptimizer, output_count_); | 250 return OFFSET_OF(Deoptimizer, output_count_); |
239 } | 251 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 virtual void GeneratePrologue(); | 288 virtual void GeneratePrologue(); |
277 | 289 |
278 private: | 290 private: |
279 int count() const { return count_; } | 291 int count() const { return count_; } |
280 | 292 |
281 int count_; | 293 int count_; |
282 }; | 294 }; |
283 | 295 |
284 int ConvertJSFrameIndexToFrameIndex(int jsframe_index); | 296 int ConvertJSFrameIndexToFrameIndex(int jsframe_index); |
285 | 297 |
| 298 static size_t GetMaxDeoptTableSize(); |
| 299 |
286 private: | 300 private: |
287 static const int kNumberOfEntries = 16384; | 301 static const int kMinNumberOfEntries = 64; |
| 302 static const int kMaxNumberOfEntries = 16384; |
288 | 303 |
289 Deoptimizer(Isolate* isolate, | 304 Deoptimizer(Isolate* isolate, |
290 JSFunction* function, | 305 JSFunction* function, |
291 BailoutType type, | 306 BailoutType type, |
292 unsigned bailout_id, | 307 unsigned bailout_id, |
293 Address from, | 308 Address from, |
294 int fp_to_sp_delta, | 309 int fp_to_sp_delta, |
295 Code* optimized_code); | 310 Code* optimized_code); |
296 void DeleteFrameDescriptions(); | 311 void DeleteFrameDescriptions(); |
297 | 312 |
(...skipping 22 matching lines...) Expand all Loading... |
320 | 335 |
321 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; | 336 unsigned ComputeIncomingArgumentSize(JSFunction* function) const; |
322 unsigned ComputeOutgoingArgumentSize() const; | 337 unsigned ComputeOutgoingArgumentSize() const; |
323 | 338 |
324 Object* ComputeLiteral(int index) const; | 339 Object* ComputeLiteral(int index) const; |
325 | 340 |
326 void AddArgumentsObject(intptr_t slot_address, int argc); | 341 void AddArgumentsObject(intptr_t slot_address, int argc); |
327 void AddArgumentsObjectValue(intptr_t value); | 342 void AddArgumentsObjectValue(intptr_t value); |
328 void AddDoubleValue(intptr_t slot_address, double value); | 343 void AddDoubleValue(intptr_t slot_address, double value); |
329 | 344 |
330 static MemoryChunk* CreateCode(BailoutType type); | 345 static void EnsureCodeForDeoptimizationEntry(BailoutType type, |
| 346 int max_entry_id); |
331 static void GenerateDeoptimizationEntries( | 347 static void GenerateDeoptimizationEntries( |
332 MacroAssembler* masm, int count, BailoutType type); | 348 MacroAssembler* masm, int count, BailoutType type); |
333 | 349 |
334 // Weak handle callback for deoptimizing code objects. | 350 // Weak handle callback for deoptimizing code objects. |
335 static void HandleWeakDeoptimizedCode( | 351 static void HandleWeakDeoptimizedCode( |
336 v8::Persistent<v8::Value> obj, void* data); | 352 v8::Persistent<v8::Value> obj, void* data); |
337 static Code* FindDeoptimizingCodeFromAddress(Address addr); | 353 static Code* FindDeoptimizingCodeFromAddress(Address addr); |
338 static void RemoveDeoptimizingCode(Code* code); | 354 static void RemoveDeoptimizingCode(Code* code); |
339 | 355 |
340 // Fill the input from from a JavaScript frame. This is used when | 356 // Fill the input from from a JavaScript frame. This is used when |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 Object** expression_stack_; | 849 Object** expression_stack_; |
834 int source_position_; | 850 int source_position_; |
835 | 851 |
836 friend class Deoptimizer; | 852 friend class Deoptimizer; |
837 }; | 853 }; |
838 #endif | 854 #endif |
839 | 855 |
840 } } // namespace v8::internal | 856 } } // namespace v8::internal |
841 | 857 |
842 #endif // V8_DEOPTIMIZER_H_ | 858 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |