OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ | 5 #ifndef RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ |
6 #define RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ | 6 #define RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return Smi::New(ReasonField::encode(reason) | FlagsField::encode(flags)); | 599 return Smi::New(ReasonField::encode(reason) | FlagsField::encode(flags)); |
600 } | 600 } |
601 | 601 |
602 class ReasonField : public BitField<intptr_t, ICData::DeoptReasonId, 0, 8> {}; | 602 class ReasonField : public BitField<intptr_t, ICData::DeoptReasonId, 0, 8> {}; |
603 class FlagsField : public BitField<intptr_t, uint32_t, 8, 8> {}; | 603 class FlagsField : public BitField<intptr_t, uint32_t, 8, 8> {}; |
604 | 604 |
605 private: | 605 private: |
606 static const intptr_t kEntrySize = 3; | 606 static const intptr_t kEntrySize = 3; |
607 }; | 607 }; |
608 | 608 |
| 609 |
| 610 // Holds deopt information at one deoptimization point. The information consists |
| 611 // of two parts: |
| 612 // - first a prefix consisting of kMaterializeObject instructions describing |
| 613 // objects which had their allocation removed as part of AllocationSinking |
| 614 // pass and have to be materialized; |
| 615 // - followed by a list of DeoptInstr objects, specifying transformation |
| 616 // information for each slot in unoptimized frame(s). |
| 617 // Arguments for object materialization (class of instance to be allocated and |
| 618 // field-value pairs) are added as artificial slots to the expression stack |
| 619 // of the bottom-most frame. They are removed from the stack at the very end |
| 620 // of deoptimization by the deoptimization stub. |
| 621 class DeoptInfo : public AllStatic { |
| 622 public: |
| 623 // Size of the frame part of the translation not counting kMaterializeObject |
| 624 // instructions in the prefix. |
| 625 static intptr_t FrameSize(const TypedData& packed); |
| 626 |
| 627 // Returns the number of kMaterializeObject instructions in the prefix. |
| 628 static intptr_t NumMaterializations(const GrowableArray<DeoptInstr*>&); |
| 629 |
| 630 // Unpack the entire translation into an array of deoptimization |
| 631 // instructions. This copies any shared suffixes into the array. |
| 632 static void Unpack(const Array& table, |
| 633 const TypedData& packed, |
| 634 GrowableArray<DeoptInstr*>* instructions); |
| 635 |
| 636 // Size of the frame part of the translation not counting kMaterializeObject |
| 637 // instructions in the prefix. |
| 638 static const char* ToCString(const Array& table, const TypedData& packed); |
| 639 |
| 640 // Returns true iff decompression yields the same instructions as the |
| 641 // original. |
| 642 static bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, |
| 643 const Array& deopt_table, |
| 644 const TypedData& packed); |
| 645 |
| 646 |
| 647 private: |
| 648 static void UnpackInto(const Array& table, |
| 649 const TypedData& packed, |
| 650 GrowableArray<DeoptInstr*>* instructions, |
| 651 intptr_t length); |
| 652 }; |
| 653 |
609 } // namespace dart | 654 } // namespace dart |
610 | 655 |
611 #endif // RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ | 656 #endif // RUNTIME_VM_DEOPT_INSTRUCTIONS_H_ |
OLD | NEW |