| 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 VM_DEFERRED_OBJECTS_H_ | 5 #ifndef VM_DEFERRED_OBJECTS_H_ |
| 6 #define VM_DEFERRED_OBJECTS_H_ | 6 #define VM_DEFERRED_OBJECTS_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class Instance; | 13 class Instance; |
| 14 class RawInstance; | 14 class RawInstance; |
| 15 class RawObject; | 15 class RawObject; |
| 16 class DeoptContext; | |
| 17 | 16 |
| 18 // Used by the deoptimization infrastructure to defer allocation of | 17 // Used by the deoptimization infrastructure to defer allocation of |
| 19 // unboxed objects until frame is fully rewritten and GC is safe. | 18 // unboxed objects until frame is fully rewritten and GC is safe. |
| 20 // Describes a stack slot that should be populated with a reference to | 19 // Describes a stack slot that should be populated with a reference to |
| 21 // the materialized object. | 20 // the materialized object. |
| 22 class DeferredSlot { | 21 class DeferredSlot { |
| 23 public: | 22 public: |
| 24 DeferredSlot(RawInstance** slot, DeferredSlot* next) | 23 DeferredSlot(RawInstance** slot, DeferredSlot* next) |
| 25 : slot_(slot), next_(next) { } | 24 : slot_(slot), next_(next) { } |
| 26 virtual ~DeferredSlot() { } | 25 virtual ~DeferredSlot() { } |
| 27 | 26 |
| 28 RawInstance** slot() const { return slot_; } | 27 RawInstance** slot() const { return slot_; } |
| 29 DeferredSlot* next() const { return next_; } | 28 DeferredSlot* next() const { return next_; } |
| 30 | 29 |
| 31 virtual void Materialize(DeoptContext* deopt_context) = 0; | 30 virtual void Materialize() = 0; |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 RawInstance** const slot_; | 33 RawInstance** const slot_; |
| 35 DeferredSlot* const next_; | 34 DeferredSlot* const next_; |
| 36 | 35 |
| 37 DISALLOW_COPY_AND_ASSIGN(DeferredSlot); | 36 DISALLOW_COPY_AND_ASSIGN(DeferredSlot); |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 | 39 |
| 41 class DeferredDouble : public DeferredSlot { | 40 class DeferredDouble : public DeferredSlot { |
| 42 public: | 41 public: |
| 43 DeferredDouble(double value, RawInstance** slot, DeferredSlot* next) | 42 DeferredDouble(double value, RawInstance** slot, DeferredSlot* next) |
| 44 : DeferredSlot(slot, next), value_(value) { } | 43 : DeferredSlot(slot, next), value_(value) { } |
| 45 | 44 |
| 46 virtual void Materialize(DeoptContext* deopt_context); | 45 virtual void Materialize(); |
| 47 | 46 |
| 48 double value() const { return value_; } | 47 double value() const { return value_; } |
| 49 | 48 |
| 50 private: | 49 private: |
| 51 const double value_; | 50 const double value_; |
| 52 | 51 |
| 53 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); | 52 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); |
| 54 }; | 53 }; |
| 55 | 54 |
| 56 | 55 |
| 57 class DeferredMint : public DeferredSlot { | 56 class DeferredMint : public DeferredSlot { |
| 58 public: | 57 public: |
| 59 DeferredMint(int64_t value, RawInstance** slot, DeferredSlot* next) | 58 DeferredMint(int64_t value, RawInstance** slot, DeferredSlot* next) |
| 60 : DeferredSlot(slot, next), value_(value) { } | 59 : DeferredSlot(slot, next), value_(value) { } |
| 61 | 60 |
| 62 virtual void Materialize(DeoptContext* deopt_context); | 61 virtual void Materialize(); |
| 63 | 62 |
| 64 int64_t value() const { return value_; } | 63 int64_t value() const { return value_; } |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 const int64_t value_; | 66 const int64_t value_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(DeferredMint); | 68 DISALLOW_COPY_AND_ASSIGN(DeferredMint); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 | 71 |
| 73 class DeferredFloat32x4 : public DeferredSlot { | 72 class DeferredFloat32x4 : public DeferredSlot { |
| 74 public: | 73 public: |
| 75 DeferredFloat32x4(simd128_value_t value, RawInstance** slot, | 74 DeferredFloat32x4(simd128_value_t value, RawInstance** slot, |
| 76 DeferredSlot* next) | 75 DeferredSlot* next) |
| 77 : DeferredSlot(slot, next), value_(value) { } | 76 : DeferredSlot(slot, next), value_(value) { } |
| 78 | 77 |
| 79 virtual void Materialize(DeoptContext* deopt_context); | 78 virtual void Materialize(); |
| 80 | 79 |
| 81 simd128_value_t value() const { return value_; } | 80 simd128_value_t value() const { return value_; } |
| 82 | 81 |
| 83 private: | 82 private: |
| 84 const simd128_value_t value_; | 83 const simd128_value_t value_; |
| 85 | 84 |
| 86 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); | 85 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 | 88 |
| 90 class DeferredInt32x4 : public DeferredSlot { | 89 class DeferredInt32x4 : public DeferredSlot { |
| 91 public: | 90 public: |
| 92 DeferredInt32x4(simd128_value_t value, RawInstance** slot, | 91 DeferredInt32x4(simd128_value_t value, RawInstance** slot, |
| 93 DeferredSlot* next) | 92 DeferredSlot* next) |
| 94 : DeferredSlot(slot, next), value_(value) { } | 93 : DeferredSlot(slot, next), value_(value) { } |
| 95 | 94 |
| 96 virtual void Materialize(DeoptContext* deopt_context); | 95 virtual void Materialize(); |
| 97 | 96 |
| 98 simd128_value_t value() const { return value_; } | 97 simd128_value_t value() const { return value_; } |
| 99 | 98 |
| 100 private: | 99 private: |
| 101 const simd128_value_t value_; | 100 const simd128_value_t value_; |
| 102 | 101 |
| 103 DISALLOW_COPY_AND_ASSIGN(DeferredInt32x4); | 102 DISALLOW_COPY_AND_ASSIGN(DeferredInt32x4); |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 | 105 |
| 107 // Describes a slot that contains a reference to an object that had its | 106 // Describes a slot that contains a reference to an object that had its |
| 108 // allocation removed by AllocationSinking pass. | 107 // allocation removed by AllocationSinking pass. |
| 109 // Object itself is described and materialized by DeferredObject. | 108 // Object itself is described and materialized by DeferredObject. |
| 110 class DeferredObjectRef : public DeferredSlot { | 109 class DeferredObjectRef : public DeferredSlot { |
| 111 public: | 110 public: |
| 112 DeferredObjectRef(intptr_t index, RawInstance** slot, DeferredSlot* next) | 111 DeferredObjectRef(intptr_t index, RawInstance** slot, DeferredSlot* next) |
| 113 : DeferredSlot(slot, next), index_(index) { } | 112 : DeferredSlot(slot, next), index_(index) { } |
| 114 | 113 |
| 115 virtual void Materialize(DeoptContext* deopt_context); | 114 virtual void Materialize(); |
| 116 | 115 |
| 117 intptr_t index() const { return index_; } | 116 intptr_t index() const { return index_; } |
| 118 | 117 |
| 119 private: | 118 private: |
| 120 const intptr_t index_; | 119 const intptr_t index_; |
| 121 | 120 |
| 122 DISALLOW_COPY_AND_ASSIGN(DeferredObjectRef); | 121 DISALLOW_COPY_AND_ASSIGN(DeferredObjectRef); |
| 123 }; | 122 }; |
| 124 | 123 |
| 125 | 124 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 178 |
| 180 // Object materialized from this description. | 179 // Object materialized from this description. |
| 181 const Instance* object_; | 180 const Instance* object_; |
| 182 | 181 |
| 183 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | 182 DISALLOW_COPY_AND_ASSIGN(DeferredObject); |
| 184 }; | 183 }; |
| 185 | 184 |
| 186 } // namespace dart | 185 } // namespace dart |
| 187 | 186 |
| 188 #endif // VM_DEFERRED_OBJECTS_H_ | 187 #endif // VM_DEFERRED_OBJECTS_H_ |
| OLD | NEW |