| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 kValueIndex, | 224 kValueIndex, |
| 225 kFieldEntrySize, | 225 kFieldEntrySize, |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 // Allocate the object but keep its fields null-initialized. Actual field | 228 // Allocate the object but keep its fields null-initialized. Actual field |
| 229 // values will be filled later by the Fill method. This separation between | 229 // values will be filled later by the Fill method. This separation between |
| 230 // allocation and filling is needed because dematerialized objects form | 230 // allocation and filling is needed because dematerialized objects form |
| 231 // a graph which can contain cycles. | 231 // a graph which can contain cycles. |
| 232 void Create(); | 232 void Create(); |
| 233 | 233 |
| 234 RawObject* GetArg(intptr_t index) const { |
| 235 #if !defined(TARGET_ARCH_DBC) |
| 236 return args_[index]; |
| 237 #else |
| 238 return args_[-index]; |
| 239 #endif |
| 240 } |
| 241 |
| 234 RawObject* GetClass() const { | 242 RawObject* GetClass() const { |
| 235 return args_[kClassIndex]; | 243 return GetArg(kClassIndex); |
| 236 } | 244 } |
| 237 | 245 |
| 238 RawObject* GetLength() const { | 246 RawObject* GetLength() const { |
| 239 return args_[kLengthIndex]; | 247 return GetArg(kLengthIndex); |
| 240 } | 248 } |
| 241 | 249 |
| 242 RawObject* GetFieldOffset(intptr_t index) const { | 250 RawObject* GetFieldOffset(intptr_t index) const { |
| 243 return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex]; | 251 return GetArg(kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex); |
| 244 } | 252 } |
| 245 | 253 |
| 246 RawObject* GetValue(intptr_t index) const { | 254 RawObject* GetValue(intptr_t index) const { |
| 247 return args_[kFieldsStartIndex + kFieldEntrySize * index + kValueIndex]; | 255 return GetArg(kFieldsStartIndex + kFieldEntrySize * index + kValueIndex); |
| 248 } | 256 } |
| 249 | 257 |
| 250 // Amount of fields that have to be initialized. | 258 // Amount of fields that have to be initialized. |
| 251 const intptr_t field_count_; | 259 const intptr_t field_count_; |
| 252 | 260 |
| 253 // Pointer to the first materialization argument on the stack. | 261 // Pointer to the first materialization argument on the stack. |
| 254 // The first argument is Class of the instance to materialize followed by | 262 // The first argument is Class of the instance to materialize followed by |
| 255 // Field, value pairs. | 263 // Field, value pairs. |
| 256 RawObject** args_; | 264 RawObject** args_; |
| 257 | 265 |
| 258 // Object materialized from this description. | 266 // Object materialized from this description. |
| 259 const Object* object_; | 267 const Object* object_; |
| 260 | 268 |
| 261 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | 269 DISALLOW_COPY_AND_ASSIGN(DeferredObject); |
| 262 }; | 270 }; |
| 263 | 271 |
| 264 } // namespace dart | 272 } // namespace dart |
| 265 | 273 |
| 266 #endif // VM_DEFERRED_OBJECTS_H_ | 274 #endif // VM_DEFERRED_OBJECTS_H_ |
| OLD | NEW |