| 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_DEFERRED_OBJECTS_H_ | 5 #ifndef RUNTIME_VM_DEFERRED_OBJECTS_H_ |
| 6 #define RUNTIME_VM_DEFERRED_OBJECTS_H_ | 6 #define RUNTIME_VM_DEFERRED_OBJECTS_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 virtual void Materialize(DeoptContext* deopt_context) = 0; | 31 virtual void Materialize(DeoptContext* deopt_context) = 0; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 RawObject** const slot_; | 34 RawObject** const slot_; |
| 35 DeferredSlot* const next_; | 35 DeferredSlot* const next_; |
| 36 | 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(DeferredSlot); | 37 DISALLOW_COPY_AND_ASSIGN(DeferredSlot); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 | |
| 41 class DeferredDouble : public DeferredSlot { | 40 class DeferredDouble : public DeferredSlot { |
| 42 public: | 41 public: |
| 43 DeferredDouble(double value, RawObject** slot, DeferredSlot* next) | 42 DeferredDouble(double value, RawObject** 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(DeoptContext* deopt_context); |
| 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 | |
| 57 class DeferredMint : public DeferredSlot { | 55 class DeferredMint : public DeferredSlot { |
| 58 public: | 56 public: |
| 59 DeferredMint(int64_t value, RawObject** slot, DeferredSlot* next) | 57 DeferredMint(int64_t value, RawObject** slot, DeferredSlot* next) |
| 60 : DeferredSlot(slot, next), value_(value) {} | 58 : DeferredSlot(slot, next), value_(value) {} |
| 61 | 59 |
| 62 virtual void Materialize(DeoptContext* deopt_context); | 60 virtual void Materialize(DeoptContext* deopt_context); |
| 63 | 61 |
| 64 int64_t value() const { return value_; } | 62 int64_t value() const { return value_; } |
| 65 | 63 |
| 66 private: | 64 private: |
| 67 const int64_t value_; | 65 const int64_t value_; |
| 68 | 66 |
| 69 DISALLOW_COPY_AND_ASSIGN(DeferredMint); | 67 DISALLOW_COPY_AND_ASSIGN(DeferredMint); |
| 70 }; | 68 }; |
| 71 | 69 |
| 72 | |
| 73 class DeferredFloat32x4 : public DeferredSlot { | 70 class DeferredFloat32x4 : public DeferredSlot { |
| 74 public: | 71 public: |
| 75 DeferredFloat32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) | 72 DeferredFloat32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) |
| 76 : DeferredSlot(slot, next), value_(value) {} | 73 : DeferredSlot(slot, next), value_(value) {} |
| 77 | 74 |
| 78 virtual void Materialize(DeoptContext* deopt_context); | 75 virtual void Materialize(DeoptContext* deopt_context); |
| 79 | 76 |
| 80 simd128_value_t value() const { return value_; } | 77 simd128_value_t value() const { return value_; } |
| 81 | 78 |
| 82 private: | 79 private: |
| 83 const simd128_value_t value_; | 80 const simd128_value_t value_; |
| 84 | 81 |
| 85 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); | 82 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); |
| 86 }; | 83 }; |
| 87 | 84 |
| 88 | |
| 89 class DeferredFloat64x2 : public DeferredSlot { | 85 class DeferredFloat64x2 : public DeferredSlot { |
| 90 public: | 86 public: |
| 91 DeferredFloat64x2(simd128_value_t value, RawObject** slot, DeferredSlot* next) | 87 DeferredFloat64x2(simd128_value_t value, RawObject** slot, DeferredSlot* next) |
| 92 : DeferredSlot(slot, next), value_(value) {} | 88 : DeferredSlot(slot, next), value_(value) {} |
| 93 | 89 |
| 94 virtual void Materialize(DeoptContext* deopt_context); | 90 virtual void Materialize(DeoptContext* deopt_context); |
| 95 | 91 |
| 96 simd128_value_t value() const { return value_; } | 92 simd128_value_t value() const { return value_; } |
| 97 | 93 |
| 98 private: | 94 private: |
| 99 const simd128_value_t value_; | 95 const simd128_value_t value_; |
| 100 | 96 |
| 101 DISALLOW_COPY_AND_ASSIGN(DeferredFloat64x2); | 97 DISALLOW_COPY_AND_ASSIGN(DeferredFloat64x2); |
| 102 }; | 98 }; |
| 103 | 99 |
| 104 | |
| 105 class DeferredInt32x4 : public DeferredSlot { | 100 class DeferredInt32x4 : public DeferredSlot { |
| 106 public: | 101 public: |
| 107 DeferredInt32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) | 102 DeferredInt32x4(simd128_value_t value, RawObject** slot, DeferredSlot* next) |
| 108 : DeferredSlot(slot, next), value_(value) {} | 103 : DeferredSlot(slot, next), value_(value) {} |
| 109 | 104 |
| 110 virtual void Materialize(DeoptContext* deopt_context); | 105 virtual void Materialize(DeoptContext* deopt_context); |
| 111 | 106 |
| 112 simd128_value_t value() const { return value_; } | 107 simd128_value_t value() const { return value_; } |
| 113 | 108 |
| 114 private: | 109 private: |
| 115 const simd128_value_t value_; | 110 const simd128_value_t value_; |
| 116 | 111 |
| 117 DISALLOW_COPY_AND_ASSIGN(DeferredInt32x4); | 112 DISALLOW_COPY_AND_ASSIGN(DeferredInt32x4); |
| 118 }; | 113 }; |
| 119 | 114 |
| 120 | |
| 121 // Describes a slot that contains a reference to an object that had its | 115 // Describes a slot that contains a reference to an object that had its |
| 122 // allocation removed by AllocationSinking pass. | 116 // allocation removed by AllocationSinking pass. |
| 123 // Object itself is described and materialized by DeferredObject. | 117 // Object itself is described and materialized by DeferredObject. |
| 124 class DeferredObjectRef : public DeferredSlot { | 118 class DeferredObjectRef : public DeferredSlot { |
| 125 public: | 119 public: |
| 126 DeferredObjectRef(intptr_t index, RawObject** slot, DeferredSlot* next) | 120 DeferredObjectRef(intptr_t index, RawObject** slot, DeferredSlot* next) |
| 127 : DeferredSlot(slot, next), index_(index) {} | 121 : DeferredSlot(slot, next), index_(index) {} |
| 128 | 122 |
| 129 virtual void Materialize(DeoptContext* deopt_context); | 123 virtual void Materialize(DeoptContext* deopt_context); |
| 130 | 124 |
| 131 intptr_t index() const { return index_; } | 125 intptr_t index() const { return index_; } |
| 132 | 126 |
| 133 private: | 127 private: |
| 134 const intptr_t index_; | 128 const intptr_t index_; |
| 135 | 129 |
| 136 DISALLOW_COPY_AND_ASSIGN(DeferredObjectRef); | 130 DISALLOW_COPY_AND_ASSIGN(DeferredObjectRef); |
| 137 }; | 131 }; |
| 138 | 132 |
| 139 | |
| 140 class DeferredRetAddr : public DeferredSlot { | 133 class DeferredRetAddr : public DeferredSlot { |
| 141 public: | 134 public: |
| 142 DeferredRetAddr(intptr_t index, | 135 DeferredRetAddr(intptr_t index, |
| 143 intptr_t deopt_id, | 136 intptr_t deopt_id, |
| 144 RawObject** slot, | 137 RawObject** slot, |
| 145 DeferredSlot* next) | 138 DeferredSlot* next) |
| 146 : DeferredSlot(slot, next), index_(index), deopt_id_(deopt_id) {} | 139 : DeferredSlot(slot, next), index_(index), deopt_id_(deopt_id) {} |
| 147 | 140 |
| 148 virtual void Materialize(DeoptContext* deopt_context); | 141 virtual void Materialize(DeoptContext* deopt_context); |
| 149 | 142 |
| 150 intptr_t index() const { return index_; } | 143 intptr_t index() const { return index_; } |
| 151 | 144 |
| 152 private: | 145 private: |
| 153 const intptr_t index_; | 146 const intptr_t index_; |
| 154 const intptr_t deopt_id_; | 147 const intptr_t deopt_id_; |
| 155 | 148 |
| 156 DISALLOW_COPY_AND_ASSIGN(DeferredRetAddr); | 149 DISALLOW_COPY_AND_ASSIGN(DeferredRetAddr); |
| 157 }; | 150 }; |
| 158 | 151 |
| 159 | |
| 160 class DeferredPcMarker : public DeferredSlot { | 152 class DeferredPcMarker : public DeferredSlot { |
| 161 public: | 153 public: |
| 162 DeferredPcMarker(intptr_t index, RawObject** slot, DeferredSlot* next) | 154 DeferredPcMarker(intptr_t index, RawObject** slot, DeferredSlot* next) |
| 163 : DeferredSlot(slot, next), index_(index) {} | 155 : DeferredSlot(slot, next), index_(index) {} |
| 164 | 156 |
| 165 virtual void Materialize(DeoptContext* deopt_context); | 157 virtual void Materialize(DeoptContext* deopt_context); |
| 166 | 158 |
| 167 intptr_t index() const { return index_; } | 159 intptr_t index() const { return index_; } |
| 168 | 160 |
| 169 private: | 161 private: |
| 170 const intptr_t index_; | 162 const intptr_t index_; |
| 171 | 163 |
| 172 DISALLOW_COPY_AND_ASSIGN(DeferredPcMarker); | 164 DISALLOW_COPY_AND_ASSIGN(DeferredPcMarker); |
| 173 }; | 165 }; |
| 174 | 166 |
| 175 | |
| 176 class DeferredPp : public DeferredSlot { | 167 class DeferredPp : public DeferredSlot { |
| 177 public: | 168 public: |
| 178 DeferredPp(intptr_t index, RawObject** slot, DeferredSlot* next) | 169 DeferredPp(intptr_t index, RawObject** slot, DeferredSlot* next) |
| 179 : DeferredSlot(slot, next), index_(index) {} | 170 : DeferredSlot(slot, next), index_(index) {} |
| 180 | 171 |
| 181 virtual void Materialize(DeoptContext* deopt_context); | 172 virtual void Materialize(DeoptContext* deopt_context); |
| 182 | 173 |
| 183 intptr_t index() const { return index_; } | 174 intptr_t index() const { return index_; } |
| 184 | 175 |
| 185 private: | 176 private: |
| 186 const intptr_t index_; | 177 const intptr_t index_; |
| 187 | 178 |
| 188 DISALLOW_COPY_AND_ASSIGN(DeferredPp); | 179 DISALLOW_COPY_AND_ASSIGN(DeferredPp); |
| 189 }; | 180 }; |
| 190 | 181 |
| 191 | |
| 192 // Describes an object which allocation was removed by AllocationSinking pass. | 182 // Describes an object which allocation was removed by AllocationSinking pass. |
| 193 // Arguments for materialization are stored as a part of expression stack | 183 // Arguments for materialization are stored as a part of expression stack |
| 194 // for the bottommost deoptimized frame so that GC could discover them. | 184 // for the bottommost deoptimized frame so that GC could discover them. |
| 195 // They will be removed from the stack at the very end of deoptimization. | 185 // They will be removed from the stack at the very end of deoptimization. |
| 196 class DeferredObject { | 186 class DeferredObject { |
| 197 public: | 187 public: |
| 198 DeferredObject(intptr_t field_count, intptr_t* args) | 188 DeferredObject(intptr_t field_count, intptr_t* args) |
| 199 : field_count_(field_count), | 189 : field_count_(field_count), |
| 200 args_(reinterpret_cast<RawObject**>(args)), | 190 args_(reinterpret_cast<RawObject**>(args)), |
| 201 object_(NULL) {} | 191 object_(NULL) {} |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 248 |
| 259 // Object materialized from this description. | 249 // Object materialized from this description. |
| 260 const Object* object_; | 250 const Object* object_; |
| 261 | 251 |
| 262 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | 252 DISALLOW_COPY_AND_ASSIGN(DeferredObject); |
| 263 }; | 253 }; |
| 264 | 254 |
| 265 } // namespace dart | 255 } // namespace dart |
| 266 | 256 |
| 267 #endif // RUNTIME_VM_DEFERRED_OBJECTS_H_ | 257 #endif // RUNTIME_VM_DEFERRED_OBJECTS_H_ |
| OLD | NEW |