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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 EAGER, | 112 EAGER, |
113 LAZY, | 113 LAZY, |
114 OSR, | 114 OSR, |
115 // This last bailout type is not really a bailout, but used by the | 115 // This last bailout type is not really a bailout, but used by the |
116 // debugger to deoptimize stack frames to allow inspection. | 116 // debugger to deoptimize stack frames to allow inspection. |
117 DEBUGGER | 117 DEBUGGER |
118 }; | 118 }; |
119 | 119 |
120 int output_count() const { return output_count_; } | 120 int output_count() const { return output_count_; } |
121 | 121 |
| 122 // Number of created JS frames. Not all created frames are necessarily JS. |
| 123 int jsframes_count() const { return jsframes_count_; } |
| 124 |
122 static Deoptimizer* New(JSFunction* function, | 125 static Deoptimizer* New(JSFunction* function, |
123 BailoutType type, | 126 BailoutType type, |
124 unsigned bailout_id, | 127 unsigned bailout_id, |
125 Address from, | 128 Address from, |
126 int fp_to_sp_delta, | 129 int fp_to_sp_delta, |
127 Isolate* isolate); | 130 Isolate* isolate); |
128 static Deoptimizer* Grab(Isolate* isolate); | 131 static Deoptimizer* Grab(Isolate* isolate); |
129 | 132 |
130 #ifdef ENABLE_DEBUGGER_SUPPORT | 133 #ifdef ENABLE_DEBUGGER_SUPPORT |
131 // The returned object with information on the optimized frame needs to be | 134 // The returned object with information on the optimized frame needs to be |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 BailoutType type, | 268 BailoutType type, |
266 unsigned bailout_id, | 269 unsigned bailout_id, |
267 Address from, | 270 Address from, |
268 int fp_to_sp_delta, | 271 int fp_to_sp_delta, |
269 Code* optimized_code); | 272 Code* optimized_code); |
270 void DeleteFrameDescriptions(); | 273 void DeleteFrameDescriptions(); |
271 | 274 |
272 void DoComputeOutputFrames(); | 275 void DoComputeOutputFrames(); |
273 void DoComputeOsrOutputFrame(); | 276 void DoComputeOsrOutputFrame(); |
274 void DoComputeFrame(TranslationIterator* iterator, int frame_index); | 277 void DoComputeFrame(TranslationIterator* iterator, int frame_index); |
| 278 void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, |
| 279 int frame_index); |
275 void DoTranslateCommand(TranslationIterator* iterator, | 280 void DoTranslateCommand(TranslationIterator* iterator, |
276 int frame_index, | 281 int frame_index, |
277 unsigned output_offset); | 282 unsigned output_offset); |
278 // Translate a command for OSR. Updates the input offset to be used for | 283 // Translate a command for OSR. Updates the input offset to be used for |
279 // the next command. Returns false if translation of the command failed | 284 // the next command. Returns false if translation of the command failed |
280 // (e.g., a number conversion failed) and may or may not have updated the | 285 // (e.g., a number conversion failed) and may or may not have updated the |
281 // input offset. | 286 // input offset. |
282 bool DoOsrTranslateCommand(TranslationIterator* iterator, | 287 bool DoOsrTranslateCommand(TranslationIterator* iterator, |
283 int* input_offset); | 288 int* input_offset); |
284 | 289 |
(...skipping 27 matching lines...) Expand all Loading... |
312 Code* optimized_code_; | 317 Code* optimized_code_; |
313 unsigned bailout_id_; | 318 unsigned bailout_id_; |
314 BailoutType bailout_type_; | 319 BailoutType bailout_type_; |
315 Address from_; | 320 Address from_; |
316 int fp_to_sp_delta_; | 321 int fp_to_sp_delta_; |
317 | 322 |
318 // Input frame description. | 323 // Input frame description. |
319 FrameDescription* input_; | 324 FrameDescription* input_; |
320 // Number of output frames. | 325 // Number of output frames. |
321 int output_count_; | 326 int output_count_; |
| 327 // Number of output js frames. |
| 328 int jsframes_count_; |
322 // Array of output frame descriptions. | 329 // Array of output frame descriptions. |
323 FrameDescription** output_; | 330 FrameDescription** output_; |
324 | 331 |
325 // Frames can be dynamically padded on ia32 to align untagged doubles. | 332 // Frames can be dynamically padded on ia32 to align untagged doubles. |
326 Object* frame_alignment_marker_; | 333 Object* frame_alignment_marker_; |
327 intptr_t has_alignment_padding_; | 334 intptr_t has_alignment_padding_; |
328 | 335 |
329 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; | 336 List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; |
330 | 337 |
331 static const int table_entry_size_; | 338 static const int table_entry_size_; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 ByteArray* buffer_; | 542 ByteArray* buffer_; |
536 int index_; | 543 int index_; |
537 }; | 544 }; |
538 | 545 |
539 | 546 |
540 class Translation BASE_EMBEDDED { | 547 class Translation BASE_EMBEDDED { |
541 public: | 548 public: |
542 enum Opcode { | 549 enum Opcode { |
543 BEGIN, | 550 BEGIN, |
544 FRAME, | 551 FRAME, |
| 552 ARGUMENTS_ADAPTOR_FRAME, |
545 REGISTER, | 553 REGISTER, |
546 INT32_REGISTER, | 554 INT32_REGISTER, |
547 DOUBLE_REGISTER, | 555 DOUBLE_REGISTER, |
548 STACK_SLOT, | 556 STACK_SLOT, |
549 INT32_STACK_SLOT, | 557 INT32_STACK_SLOT, |
550 DOUBLE_STACK_SLOT, | 558 DOUBLE_STACK_SLOT, |
551 LITERAL, | 559 LITERAL, |
552 ARGUMENTS_OBJECT, | 560 ARGUMENTS_OBJECT, |
553 | 561 |
554 // A prefix indicating that the next command is a duplicate of the one | 562 // A prefix indicating that the next command is a duplicate of the one |
555 // that follows it. | 563 // that follows it. |
556 DUPLICATE | 564 DUPLICATE |
557 }; | 565 }; |
558 | 566 |
559 Translation(TranslationBuffer* buffer, int frame_count) | 567 Translation(TranslationBuffer* buffer, int frame_count) |
560 : buffer_(buffer), | 568 : buffer_(buffer), |
561 index_(buffer->CurrentIndex()) { | 569 index_(buffer->CurrentIndex()) { |
562 buffer_->Add(BEGIN); | 570 buffer_->Add(BEGIN); |
563 buffer_->Add(frame_count); | 571 buffer_->Add(frame_count); |
564 } | 572 } |
565 | 573 |
566 int index() const { return index_; } | 574 int index() const { return index_; } |
567 | 575 |
568 // Commands. | 576 // Commands. |
569 void BeginFrame(int node_id, int literal_id, unsigned height); | 577 void BeginFrame(int node_id, int literal_id, unsigned height); |
| 578 void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); |
570 void StoreRegister(Register reg); | 579 void StoreRegister(Register reg); |
571 void StoreInt32Register(Register reg); | 580 void StoreInt32Register(Register reg); |
572 void StoreDoubleRegister(DoubleRegister reg); | 581 void StoreDoubleRegister(DoubleRegister reg); |
573 void StoreStackSlot(int index); | 582 void StoreStackSlot(int index); |
574 void StoreInt32StackSlot(int index); | 583 void StoreInt32StackSlot(int index); |
575 void StoreDoubleStackSlot(int index); | 584 void StoreDoubleStackSlot(int index); |
576 void StoreLiteral(int literal_id); | 585 void StoreLiteral(int literal_id); |
577 void StoreArgumentsObject(); | 586 void StoreArgumentsObject(); |
578 void MarkDuplicate(); | 587 void MarkDuplicate(); |
579 | 588 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 Object** parameters_; | 750 Object** parameters_; |
742 Object** expression_stack_; | 751 Object** expression_stack_; |
743 | 752 |
744 friend class Deoptimizer; | 753 friend class Deoptimizer; |
745 }; | 754 }; |
746 #endif | 755 #endif |
747 | 756 |
748 } } // namespace v8::internal | 757 } } // namespace v8::internal |
749 | 758 |
750 #endif // V8_DEOPTIMIZER_H_ | 759 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |