| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" | 10 #include "vm/token.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 friend class TypedDataView; | 449 friend class TypedDataView; |
| 450 | 450 |
| 451 DISALLOW_ALLOCATION(); | 451 DISALLOW_ALLOCATION(); |
| 452 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 452 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
| 453 }; | 453 }; |
| 454 | 454 |
| 455 | 455 |
| 456 class RawClass : public RawObject { | 456 class RawClass : public RawObject { |
| 457 public: | 457 public: |
| 458 enum ClassState { | 458 enum ClassState { |
| 459 kAllocated, // Initial state. | 459 kAllocated = 0, // Initial state. |
| 460 kPreFinalized, // VM classes: size precomputed, but no checks done. | 460 kPreFinalized, // VM classes: size precomputed, but no checks done. |
| 461 kFinalized, // All checks completed, class ready for use. | 461 kFinalized, // Class parsed, finalized and ready for use. |
| 462 }; | 462 }; |
| 463 | 463 |
| 464 private: | 464 private: |
| 465 RAW_HEAP_OBJECT_IMPLEMENTATION(Class); | 465 RAW_HEAP_OBJECT_IMPLEMENTATION(Class); |
| 466 | 466 |
| 467 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 467 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 468 RawString* name_; | 468 RawString* name_; |
| 469 RawArray* functions_; | 469 RawArray* functions_; |
| 470 RawArray* fields_; | 470 RawArray* fields_; |
| 471 RawGrowableObjectArray* closure_functions_; // Local functions and literals. | 471 RawGrowableObjectArray* closure_functions_; // Local functions and literals. |
| 472 RawArray* interfaces_; // Array of AbstractType. | 472 RawArray* interfaces_; // Array of AbstractType. |
| 473 RawGrowableObjectArray* direct_subclasses_; // Array of Class. | 473 RawGrowableObjectArray* direct_subclasses_; // Array of Class. |
| 474 RawScript* script_; | 474 RawScript* script_; |
| 475 RawLibrary* library_; | 475 RawLibrary* library_; |
| 476 RawTypeArguments* type_parameters_; // Array of TypeParameter. | 476 RawTypeArguments* type_parameters_; // Array of TypeParameter. |
| 477 RawAbstractType* super_type_; | 477 RawAbstractType* super_type_; |
| 478 RawType* mixin_; | 478 RawType* mixin_; |
| 479 RawClass* patch_class_; |
| 479 RawFunction* signature_function_; // Associated function for signature class. | 480 RawFunction* signature_function_; // Associated function for signature class. |
| 480 RawArray* constants_; // Canonicalized values of this class. | 481 RawArray* constants_; // Canonicalized values of this class. |
| 481 RawArray* canonical_types_; // Canonicalized types of this class. | 482 RawArray* canonical_types_; // Canonicalized types of this class. |
| 482 RawCode* allocation_stub_; // Stub code for allocation of instances. | 483 RawCode* allocation_stub_; // Stub code for allocation of instances. |
| 483 RawObject** to() { | 484 RawObject** to() { |
| 484 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); | 485 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); |
| 485 } | 486 } |
| 486 | 487 |
| 487 cpp_vtable handle_vtable_; | 488 cpp_vtable handle_vtable_; |
| 488 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. | 489 intptr_t instance_size_in_words_; // Size if fixed len or 0 if variable len. |
| 489 intptr_t id_; // Class Id, also index in the class table. | 490 intptr_t id_; // Class Id, also index in the class table. |
| 490 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. | 491 intptr_t type_arguments_field_offset_in_words_; // Offset of type args fld. |
| 491 intptr_t next_field_offset_in_words_; // Offset of the next instance field. | 492 intptr_t next_field_offset_in_words_; // Offset of the next instance field. |
| 492 intptr_t num_native_fields_; // Number of native fields in class. | 493 intptr_t num_native_fields_; // Number of native fields in class. |
| 493 intptr_t token_pos_; | 494 intptr_t token_pos_; |
| 494 uint8_t state_bits_; // state, is_const, is_implemented. | 495 uint16_t state_bits_; // state, is_[const|implemented|synthesized|abstract]. |
| 495 | 496 |
| 496 friend class Instance; | 497 friend class Instance; |
| 497 friend class Object; | 498 friend class Object; |
| 498 friend class RawInstance; | 499 friend class RawInstance; |
| 499 friend class RawInstructions; | 500 friend class RawInstructions; |
| 500 friend class RawType; // TODO(regis): To temporarily print unfinalized types. | 501 friend class RawType; // TODO(regis): To temporarily print unfinalized types. |
| 501 friend class RawTypeParameter; // To temporarily print unfinalized types. | 502 friend class RawTypeParameter; // To temporarily print unfinalized types. |
| 502 friend class SnapshotReader; | 503 friend class SnapshotReader; |
| 503 }; | 504 }; |
| 504 | 505 |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 // Make sure this is updated when new TypedData types are added. | 1680 // Make sure this is updated when new TypedData types are added. |
| 1680 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); | 1681 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); |
| 1681 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); | 1682 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); |
| 1682 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); | 1683 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); |
| 1683 return (kNullCid - kTypedDataInt8ArrayCid); | 1684 return (kNullCid - kTypedDataInt8ArrayCid); |
| 1684 } | 1685 } |
| 1685 | 1686 |
| 1686 } // namespace dart | 1687 } // namespace dart |
| 1687 | 1688 |
| 1688 #endif // VM_RAW_OBJECT_H_ | 1689 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |