Chromium Code Reviews| 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 { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 : field_count_(field_count), | 150 : field_count_(field_count), |
| 151 args_(reinterpret_cast<RawObject**>(args)), | 151 args_(reinterpret_cast<RawObject**>(args)), |
| 152 object_(NULL) { } | 152 object_(NULL) { } |
| 153 | 153 |
| 154 intptr_t ArgumentCount() const { | 154 intptr_t ArgumentCount() const { |
| 155 return kFieldsStartIndex + kFieldEntrySize * field_count_; | 155 return kFieldsStartIndex + kFieldEntrySize * field_count_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 RawInstance* object(); | 158 RawInstance* object(); |
| 159 | 159 |
| 160 // Fill object with actual field values. | |
| 161 void Fill(); | |
| 162 | |
| 160 private: | 163 private: |
| 161 enum { | 164 enum { |
| 162 kClassIndex = 0, | 165 kClassIndex = 0, |
| 163 kFieldsStartIndex = kClassIndex + 1 | 166 kFieldsStartIndex = kClassIndex + 1 |
| 164 }; | 167 }; |
| 165 | 168 |
| 166 enum { | 169 enum { |
| 167 kOffsetIndex = 0, | 170 kOffsetIndex = 0, |
| 168 kValueIndex, | 171 kValueIndex, |
| 169 kFieldEntrySize, | 172 kFieldEntrySize, |
| 170 }; | 173 }; |
| 171 | 174 |
| 172 // Materializes the object. Returns amount of values that were consumed | 175 // Allocate the object but keep it's fields null-initialized. Actual field |
|
srdjan
2014/07/17 23:08:15
s/it's/its/
| |
| 173 // and should be removed from the expression stack at the very end of | 176 // values will be filled later by the Fill method. This separation between |
| 174 // deoptimization. | 177 // allocation and filling is needed because dematerialized objects form |
| 175 void Materialize(); | 178 // a graph which can contain cycles. |
| 179 void Create(); | |
| 176 | 180 |
| 177 RawObject* GetClass() const { | 181 RawObject* GetClass() const { |
| 178 return args_[kClassIndex]; | 182 return args_[kClassIndex]; |
| 179 } | 183 } |
| 180 | 184 |
| 181 RawObject* GetFieldOffset(intptr_t index) const { | 185 RawObject* GetFieldOffset(intptr_t index) const { |
| 182 return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex]; | 186 return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex]; |
| 183 } | 187 } |
| 184 | 188 |
| 185 RawObject* GetValue(intptr_t index) const { | 189 RawObject* GetValue(intptr_t index) const { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 196 | 200 |
| 197 // Object materialized from this description. | 201 // Object materialized from this description. |
| 198 const Instance* object_; | 202 const Instance* object_; |
| 199 | 203 |
| 200 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | 204 DISALLOW_COPY_AND_ASSIGN(DeferredObject); |
| 201 }; | 205 }; |
| 202 | 206 |
| 203 } // namespace dart | 207 } // namespace dart |
| 204 | 208 |
| 205 #endif // VM_DEFERRED_OBJECTS_H_ | 209 #endif // VM_DEFERRED_OBJECTS_H_ |
| OLD | NEW |