OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4639 static const intptr_t kMaxHandlers = 1024 * 1024; | 4639 static const intptr_t kMaxHandlers = 1024 * 1024; |
4640 | 4640 |
4641 void set_handled_types_data(const Array& value) const; | 4641 void set_handled_types_data(const Array& value) const; |
4642 | 4642 |
4643 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); | 4643 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); |
4644 friend class Class; | 4644 friend class Class; |
4645 friend class Object; | 4645 friend class Object; |
4646 }; | 4646 }; |
4647 | 4647 |
4648 | 4648 |
4649 // Holds deopt information at one deoptimization point. The information consists | |
4650 // of two parts: | |
4651 // - first a prefix consisting of kMaterializeObject instructions describing | |
4652 // objects which had their allocation removed as part of AllocationSinking | |
4653 // pass and have to be materialized; | |
4654 // - followed by a list of DeoptInstr objects, specifying transformation | |
4655 // information for each slot in unoptimized frame(s). | |
4656 // Arguments for object materialization (class of instance to be allocated and | |
4657 // field-value pairs) are added as artificial slots to the expression stack | |
4658 // of the bottom-most frame. They are removed from the stack at the very end | |
4659 // of deoptimization by the deoptimization stub. | |
4660 class DeoptInfo : public AllStatic { | |
4661 public: | |
4662 // Size of the frame part of the translation not counting kMaterializeObject | |
4663 // instructions in the prefix. | |
4664 static intptr_t FrameSize(const TypedData& packed); | |
4665 | |
4666 // Returns the number of kMaterializeObject instructions in the prefix. | |
4667 static intptr_t NumMaterializations(const GrowableArray<DeoptInstr*>&); | |
4668 | |
4669 // Unpack the entire translation into an array of deoptimization | |
4670 // instructions. This copies any shared suffixes into the array. | |
4671 static void Unpack(const Array& table, | |
4672 const TypedData& packed, | |
4673 GrowableArray<DeoptInstr*>* instructions); | |
4674 | |
4675 // Size of the frame part of the translation not counting kMaterializeObject | |
4676 // instructions in the prefix. | |
4677 static const char* ToCString(const Array& table, const TypedData& packed); | |
4678 | |
4679 // Returns true iff decompression yields the same instructions as the | |
4680 // original. | |
4681 static bool VerifyDecompression(const GrowableArray<DeoptInstr*>& original, | |
4682 const Array& deopt_table, | |
4683 const TypedData& packed); | |
4684 | |
4685 | |
4686 private: | |
4687 static void UnpackInto(const Array& table, | |
4688 const TypedData& packed, | |
4689 GrowableArray<DeoptInstr*>* instructions, | |
4690 intptr_t length); | |
4691 }; | |
4692 | |
4693 | |
4694 class Code : public Object { | 4649 class Code : public Object { |
4695 public: | 4650 public: |
4696 RawInstructions* active_instructions() const { | 4651 RawInstructions* active_instructions() const { |
4697 #if defined(DART_PRECOMPILED_RUNTIME) | 4652 #if defined(DART_PRECOMPILED_RUNTIME) |
4698 UNREACHABLE(); | 4653 UNREACHABLE(); |
4699 return NULL; | 4654 return NULL; |
4700 #else | 4655 #else |
4701 return raw_ptr()->active_instructions_; | 4656 return raw_ptr()->active_instructions_; |
4702 #endif | 4657 #endif |
4703 } | 4658 } |
(...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9058 | 9013 |
9059 inline void TypeArguments::SetHash(intptr_t value) const { | 9014 inline void TypeArguments::SetHash(intptr_t value) const { |
9060 // This is only safe because we create a new Smi, which does not cause | 9015 // This is only safe because we create a new Smi, which does not cause |
9061 // heap allocation. | 9016 // heap allocation. |
9062 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 9017 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
9063 } | 9018 } |
9064 | 9019 |
9065 } // namespace dart | 9020 } // namespace dart |
9066 | 9021 |
9067 #endif // RUNTIME_VM_OBJECT_H_ | 9022 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |