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 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 #if !defined(TARGET_ARCH_DBC) | |
| 234 RawObject* GetClass() const { | 235 RawObject* GetClass() const { |
| 235 return args_[kClassIndex]; | 236 return args_[kClassIndex]; |
| 236 } | 237 } |
| 237 | 238 |
| 238 RawObject* GetLength() const { | 239 RawObject* GetLength() const { |
| 239 return args_[kLengthIndex]; | 240 return args_[kLengthIndex]; |
| 240 } | 241 } |
| 241 | 242 |
| 242 RawObject* GetFieldOffset(intptr_t index) const { | 243 RawObject* GetFieldOffset(intptr_t index) const { |
| 243 return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex]; | 244 return args_[kFieldsStartIndex + kFieldEntrySize * index + kOffsetIndex]; |
| 244 } | 245 } |
| 245 | 246 |
| 246 RawObject* GetValue(intptr_t index) const { | 247 RawObject* GetValue(intptr_t index) const { |
| 247 return args_[kFieldsStartIndex + kFieldEntrySize * index + kValueIndex]; | 248 return args_[kFieldsStartIndex + kFieldEntrySize * index + kValueIndex]; |
| 248 } | 249 } |
| 249 | 250 |
| 251 #else | |
|
zra
2016/06/23 23:06:01
Is there a better hack to fix this problem?
Vyacheslav Egorov (Google)
2016/06/24 14:47:07
How about:
RawObject* GetArg(intptr_t index) {
#i
zra
2016/06/24 22:37:49
Done.
| |
| 252 | |
| 253 RawObject* GetClass() const { | |
| 254 return args_[-kClassIndex]; | |
| 255 } | |
| 256 | |
| 257 RawObject* GetLength() const { | |
| 258 return args_[-kLengthIndex]; | |
| 259 } | |
| 260 | |
| 261 RawObject* GetFieldOffset(intptr_t index) const { | |
| 262 return args_[-kFieldsStartIndex - kFieldEntrySize * index - kOffsetIndex]; | |
| 263 } | |
| 264 | |
| 265 RawObject* GetValue(intptr_t index) const { | |
| 266 return args_[-kFieldsStartIndex - kFieldEntrySize * index - kValueIndex]; | |
| 267 } | |
| 268 #endif // !defined(TARGET_ARCH_DBC) | |
| 269 | |
| 250 // Amount of fields that have to be initialized. | 270 // Amount of fields that have to be initialized. |
| 251 const intptr_t field_count_; | 271 const intptr_t field_count_; |
| 252 | 272 |
| 253 // Pointer to the first materialization argument on the stack. | 273 // Pointer to the first materialization argument on the stack. |
| 254 // The first argument is Class of the instance to materialize followed by | 274 // The first argument is Class of the instance to materialize followed by |
| 255 // Field, value pairs. | 275 // Field, value pairs. |
| 256 RawObject** args_; | 276 RawObject** args_; |
| 257 | 277 |
| 258 // Object materialized from this description. | 278 // Object materialized from this description. |
| 259 const Object* object_; | 279 const Object* object_; |
| 260 | 280 |
| 261 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | 281 DISALLOW_COPY_AND_ASSIGN(DeferredObject); |
| 262 }; | 282 }; |
| 263 | 283 |
| 264 } // namespace dart | 284 } // namespace dart |
| 265 | 285 |
| 266 #endif // VM_DEFERRED_OBJECTS_H_ | 286 #endif // VM_DEFERRED_OBJECTS_H_ |
| OLD | NEW |